Conversation
Aligns with other file-handle wrappers in win32.rs (ReadFileOverlapped, WriteFileOverlapped, cancel_and_wait_io) and drops the Hungarian param names.
When a redirection's File has a raw fd matching the target stream fd, install_child_fd cleared CLOEXEC but then closed the fd via prevent_dealloc, leaving the child without that standard stream after exec.
Setting up stdin/stdout/stderr one at a time was buggy when a redirection File's raw fd collided with another stream's target. This caused several issues: * the fd got overwritten (or swapped) before the next stream was set up; * an inherited standard stream at a low fd got closed when reused as a non-matching target; * a shared Arc in Pipeline stderr_all/stdout_all leaked the source fd into non-last children. This fixes the issues by resolving all three streams up front: any source fd that another stream's dup2 would overwrite is pre-duped via F_DUPFD_CLOEXEC, after which the streams are installed in fixed order. Source fds at 3 or above get CLOEXEC after dup2 so they close at exec, replacing the previous count-based explicit close that missed shared-Arc cases.
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.
No description provided.