alexch / rerun

Restarts an app when the filesystem changes. Uses growl and FSEventStream if on OS X.
Other
984 stars 80 forks source link

Fix stopping issue with --restart and add hard restart keypress #101

Closed mwpastore closed 6 years ago

mwpastore commented 8 years ago

Hi Alex,

I'm using rerun with Puma and have run into a few issues that this PR hopefully addresses.

I like to use the --restart option with --signal USR2 to let Puma quickly restart itself. This works during development, but when you go to quit out of it (i.e. a "q" keypress or Ctrl-C), it first sends a USR2 (which restarts Puma!) before timing out and eventually sending an INT. In the past I have monkeypatched in a stop_without_signal method using an execute-around pattern to "fix" this, but I think this is a better option. stop now looks to see if you're using the restart option and sends a TERM straightaway instead of the configured signal.

All that being said, there are times when you actually do want to the default behavior of rerun, which is to completely stop Puma and restart it. Specifically, if you update your bundle or any environment variables (e.g. in .env or .rbenv-vars). I've added an "f" keypress that does a "forced restart", which is the same as a restart but bypasses the restart_with_signal logic if restart is enabled.

Please let me know your thoughts. Thank you!

Mike

mwpastore commented 8 years ago

Yeah, this doesn't work. It looks like keypresses are case-insensitive! I'm looking into it.

mwpastore commented 8 years ago

There we go. Not sure why Travis is failing; the tests run fine on my local machine. Thanks Alex!

alexch commented 6 years ago

Thanks for the patch!