[RFC PATCH 1/2] run-command: add a pipe() write end to childs
- From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
- Date
- Jun 26, 2025, 21:22 UTC
- Message-ID
- <20250626212234.88570-2-carenas@gmail.com>
- In-Reply-To
- <20250626212234.88570-1-carenas@gmail.com>
Instruct the child to close the read side of a pipe provided by the parent for notification that would be used in a future patch.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> --- run-command.c | 3 +++ run-command.h | 2 ++ 2 files changed, 5 insertions(+)
diff --git a/run-command.c b/run-command.c index 8833b23367..0156d3a01d 100644 --- a/run-command.c +++ b/run-command.c @@ -796,6 +796,9 @@ int start_command(struct child_process *cmd) set_error_routine(child_error_fn); set_warn_routine(child_warn_fn); + if (cmd->parent_ipc_in != -1) + close(cmd->parent_ipc_in); + close(notify_pipe[0]); set_cloexec(notify_pipe[1]); child_notifier = notify_pipe[1]; diff --git a/run-command.h b/run-command.h index 0df25e445f..d731b400b9 100644 --- a/run-command.h +++ b/run-command.h @@ -81,6 +81,7 @@ struct child_process { const char *trace2_child_class; const char *trace2_hook_name; + int parent_ipc_in; /* * Using .in, .out, .err: * - Specify 0 for no redirections. No new file descriptor is allocated. @@ -147,6 +148,7 @@ struct child_process { #define CHILD_PROCESS_INIT { \ .args = STRVEC_INIT, \ .env = STRVEC_INIT, \ + .parent_ipc_in = -1, \ } /**
-- 2.39.5 (Apple Git-154)