• Daniel Drake's avatar
    gspawn: Add g_spawn_async_with_fds variant · 3524de16
    Daniel Drake authored
    Add a new process spawning function variant which allows the caller
    to pass specific file descriptors for stdin, stdout and stderr.
    It is otherwise identical to g_spawn_async_with_pipes.
    
    Allow the same fd to be passed in multiple parameters. To make this
    workable, the child process logic that closes the fd after the first time
    it has been dup2'ed needed tweaking; we now just set those fds to be
    closed upon exec using the CLOEXEC flag. Add a test for this case.
    
    This will be used by gnome-shell to avoid performing equivalent
    dup2 actions in a child_setup function. Dropping use of child_setup will
    enable use of an upcoming optimized process spawning codepath.
    3524de16
gspawn.h 11.5 KB