Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.child_process: enable non-standard streams #14152

Closed
wants to merge 1 commit into from

Commits on Feb 21, 2023

  1. std.child_process: enable non-standard streams

    This PR simplifies the setup code and handling of non-standard file
    descriptors and handles for Windows and Posix with main focus on pipes.
    
    Portable pipes default to pipe2 with CLOEXEC on Posix and disabled handle
    inhertance on Windows except shortly before and after the creation of
    the "child process".
    
    Leaking of file desriptors on Posix
    1. CLOEXEC does not take immediately effect with clone(), but after the
    setup code for the child process was run and a exec* function is executed.
    External code may at worst be long living and never do exec*.
    2. File descriptors without CLOEXEC are designed to "leak to the child",
    but every spawned process at the same time gets them as well.
    
    Leaking of handles on Windows
    1. File leaking on Windows can be fixed with an explicit list approach
    as suggested in ziglang#14251, which might require runtime probing and
    allocation of the necessary process setup list. Otherwise, it might
    break on Kernel updates.
    2. The potential time for leaking can be long due trying to spawn on
    multiple PATH and PATHEXT entries on Windows.
    matu3ba committed Feb 21, 2023
    Configuration menu
    Copy the full SHA
    223fd9f View commit details
    Browse the repository at this point in the history