provide an API to easily redirect stdin/stdout/stderr to /dev/null
Summary: It's somewhat common to want to ignore `stdout` / `stderr` when spawning a child, and the current mechanism we provide to do this is `folly::Subprocess::CLOSE`. However, this is somewhat dangerous when used without care, since any new files or sockets the child process opens will take on these low fds. From `man 2 open`, > The file descriptor returned by a successful call will be the lowest-numbered file descriptor not currently open for the process. Note that stdin/stdout/stderr are *not* special-cased here. To provide a safer way to not inherit or pipe the standard fds, provide a `folly::Subprocess::DEV_NULL` option instead, which hooks up the OS-relevant null device to the fd. `folly::Subprocess::CLOSE` will subsequently be removed. Reviewed By: yfeldblum, luciang Differential Revision: D30901400 fbshipit-source-id: 0b59de5da6c6a0f714233c09788fa2d0020f3823
Showing
Please register or sign in to comment