Make tig the process group leader and automatically clean child processes #828
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make tig the process-group leader and give it the foreground connection to the TTY. This announces to the OS "I am the interactive program taking input".
Being process-group leader allows for a simple and robust idiom for cleaning all child processes at exit time: tig can signal HUP to the entire process group (which tig can be certain that it owns). While tig doesn't intentionally keep very long running child processes, it does depend on child processes quite a bit, so this cleanup is just good practice.
As noted in
test/README.adoc
, this PR adds a minor issue: if the user setsstty tostop
in their interactive shell, then tig's test suite will not be able to run. Actually, it will run, but then constantly stop again as output is generated. That is as intended forstty tostop
: not to let multiple processes contend for writes to the terminal. The same problem would occur withtig-pick
.However
stty tostop
is not the default setting on any Unixlike so far as I knowtig-pick
are edge usesIf a bug report does come in regarding
tig-pick
, I'm sure there's a fix with some added complexity in eithertig
ortig-pick
.