gitomatic icon indicating copy to clipboard operation
gitomatic copied to clipboard

Check before exit when an interrupt is received

Open lwakefield opened this issue 6 years ago • 4 comments

This PR changes the program to do one final pull and push before exiting the process when an interrupt is received.

The use case I have is as follows: I have a simple script which opens a texteditor to edit notes and uses a forked gitomatic to push any changes. When the editor closes, I terminate gitomatic, however that means changes won't be pushed by gitomatic until the next run.

lwakefield avatar Dec 06 '19 19:12 lwakefield

I keep thinking about whether this is the right approach. I somewhat dislike it doing something automatically when asked to be aborted. What if I want to cancel the app because I noticed it's about to commit something it really shouldn't, like a password I typed into an editor.

Just out of interest, how do you trigger your editor terminating gitomatic on shutdown?

muesli avatar Dec 21 '19 20:12 muesli

Fair enough - I am happy to keep this as a fork if there isn't value added.

The script simply waits for the editor process to exit, then kills gitomatic:

${EDITOR} $@
kill $gitomatic_pid

lwakefield avatar Jan 02 '20 12:01 lwakefield

How about using a different Signal like SIGUSR1 or SIGINT?

morbidick avatar Feb 21 '20 09:02 morbidick

@morbidick You know, that might actually be a good idea.

muesli avatar Feb 25 '20 06:02 muesli