mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Redirect STDERR to /dev/null in process spawn
This commit is contained in:
@@ -127,6 +127,8 @@ Process::StringResult Process::spawn_get_stdout_line() {
|
|||||||
posix_spawn_file_actions_t actions;
|
posix_spawn_file_actions_t actions;
|
||||||
posix_spawn_file_actions_init(&actions);
|
posix_spawn_file_actions_init(&actions);
|
||||||
posix_spawn_file_actions_adddup2(&actions, output_pipe[1], STDOUT_FILENO);
|
posix_spawn_file_actions_adddup2(&actions, output_pipe[1], STDOUT_FILENO);
|
||||||
|
posix_spawn_file_actions_addopen(&actions, STDERR_FILENO, "/dev/null",
|
||||||
|
O_WRONLY | O_APPEND, 0);
|
||||||
posix_spawn_file_actions_addclose(&actions, output_pipe[0]);
|
posix_spawn_file_actions_addclose(&actions, output_pipe[0]);
|
||||||
posix_spawn_file_actions_addclose(&actions, output_pipe[1]);
|
posix_spawn_file_actions_addclose(&actions, output_pipe[1]);
|
||||||
|
|
||||||
|
|||||||
@@ -158,10 +158,11 @@ class Process {
|
|||||||
inline void environment(ProcessEnvironment env) { env_ = std::move(env); }
|
inline void environment(ProcessEnvironment env) { env_ = std::move(env); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawn the process, leave STDIN and STDERR alone, and return the first
|
* Spawn the process, leave STDIN, redirect STDERR to `/dev/null`, and
|
||||||
* line (without the trailing linefeed) of STDOUT. The first output line
|
* return the first line (without the trailing linefeed) of STDOUT. The
|
||||||
* will still be returned even if the process exits with a non-zero exit
|
* first output line will still be returned even if the process exits with a
|
||||||
* code. Uses `posix_spawn()`, leaves file descriptors in tact.
|
* non-zero exit code. Uses `posix_spawn()`, leaves file descriptors in
|
||||||
|
* tact.
|
||||||
*/
|
*/
|
||||||
StringResult spawn_get_stdout_line();
|
StringResult spawn_get_stdout_line();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user