Check before exit when an interrupt is received
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.
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?
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
How about using a different Signal like SIGUSR1 or SIGINT?
@morbidick You know, that might actually be a good idea.