spring
spring copied to clipboard
Setup "pgid" for server running in foreground mode
It's expected that pgid to be setup for "foreground" running server rather than for "background".
So it should be changed to set_pgid if foreground?
See discussion https://github.com/rails/spring/commit/e16e085e4e6aada8b32198e98e0c8ae1ab7b9963#r18804964
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @grosser (or someone else) soon.
If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.
Please see the contribution instructions for more information.
@jonleighton @develop7 @hjwylde plz review
LGTM
:shipit:
My memory of the spring code is not super fresh, but I think the code is correct as-is and this should not be merged.
The idea of the set_pgid method is that it ties the background spring process to the current terminal session. Therefore, when the terminal session ends, the background process also gets killed.
So I think merging this will result in orphaned spring processes accumulating on users' machines.
When running in 'foreground mode', the spring process is never detached. Therefore it will just be up to the parent process to kill it when necessary.
If people want to run spring outside of a terminal session, they should do so using spring server, then they can manage the starting/stopping manually as desired.