From 16865db3c000e4900c202d0e7d6aa5e7ed2043ca Mon Sep 17 00:00:00 2001 From: Ákos Kőrösi Date: Thu, 21 May 2026 15:30:50 +0200 Subject: trying to make out-procsub work --- src/exec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/exec.c b/src/exec.c index 4a35142..b34472c 100644 --- a/src/exec.c +++ b/src/exec.c @@ -77,6 +77,19 @@ ExecutableCommand process_pl_command(PlCommand pl_cmd) { push_to_IntVec(&parent_open_fds, ps_pipe_fds[0]); push_to_StrVec(&arg_vec, strdup(pname)); break; + case ARG_PS_OUT: + pipe(ps_pipe_fds); + execute_command_pipeline(*(Pipeline*)arg.as.sub_pipeline, ps_pipe_fds[0], STDOUT_FILENO); + + // TODO: don't do fcntl? + fcntl(ps_pipe_fds[1], F_SETFD, FD_CLOEXEC); + execute_command_pipeline(*(Pipeline*)arg.as.sub_pipeline, STDIN_FILENO, ps_pipe_fds[1]); + fcntl(ps_pipe_fds[1], F_SETFD, 0); + close(ps_pipe_fds[0]); + char name[64]; + snprintf(name, sizeof(name), "/dev/fd/%d", ps_pipe_fds[1]); + push_to_StrVec(&arg_vec, strdup(name)); + break; default: exit(67); } -- cgit v1.2.3