Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check before exit when an interrupt is received #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lwakefield
Copy link

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.

@muesli
Copy link
Owner

muesli commented Dec 21, 2019

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?

@lwakefield
Copy link
Author

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

@morbidick
Copy link

How about using a different Signal like SIGUSR1 or SIGINT?

@muesli
Copy link
Owner

muesli commented Feb 25, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants