Double fork - #137
Open
bjorn3 wants to merge 2 commits into
Open
Conversation
This ensures the service can't accidentally get a controlling tty when opening a file. It is also required in a future commit for sending the process group of the service to the background when detaching from the pty.
| Err(err) if err.kind() == io::ErrorKind::UnexpectedEof => Ok(child_pid), | ||
| Err(err) if err.kind() == io::ErrorKind::UnexpectedEof => { | ||
| let mut child_pid = [0; size_of::<pid_t>()]; | ||
| pid_rx.read_exact(&mut child_pid)?; |
Contributor
There was a problem hiding this comment.
Is it possible for this to hang with a pid_tx still around? I think this could only happen if we see a failure in a fork and pid_tx is never used there but I'm not sure.
Collaborator
Author
There was a problem hiding this comment.
pid_tx would be closed by the exec or exit, so this could only hang if the forked child hangs without ever doing an exec or exiting.
rcanderson23
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This ensures the service can't accidentally get a controlling tty when opening a file that happened to be a tty. It is also required in a future commit for sending the process group of the service to the background when detaching from the pty.
Also mark ourself as child subreaper to make testing outside of containers a bit easier.
Required for #117