From 494886acb0bf3d536f4e620340e42c8ec8947742 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 19 Oct 2022 14:10:03 +0900 Subject: spawn: Update changes from gnupg. * src/gpg-error.h.in (GPGRT_SPAWN_KEEP_STDIN): New. (GPGRT_SPAWN_KEEP_STDOUT, GPGRT_SPAWN_KEEP_STDERR): New. * src/gpgrt-int.h: Add comment. * src/spawn-posix.c (do_exec): Add the argument FLAGS. (_gpgrt_spawn_process): Add FLAGS. (_gpgrt_spawn_process_fd): Follow the change. (_gpgrt_spawn_process_detached): Likewise. * src/spawn-w32.c (_gpgrt_spawn_process): Handle FLAGS. -- This commit imports GnuPG master commit of: 6d6438a361d25f3b269f702e017f5e39fd1f5c38 GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka --- src/spawn-w32.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/spawn-w32.c') diff --git a/src/spawn-w32.c b/src/spawn-w32.c index 90c0538..8fecfa6 100644 --- a/src/spawn-w32.c +++ b/src/spawn-w32.c @@ -530,11 +530,14 @@ _gpgrt_spawn_process (const char *pgmname, const char *argv[], return err; if (inpipe[0] == INVALID_HANDLE_VALUE) - nullhd[0] = w32_open_null (0); - if (outpipe[1] == INVALID_HANDLE_VALUE) - nullhd[1] = w32_open_null (1); - if (errpipe[1] == INVALID_HANDLE_VALUE) - nullhd[2] = w32_open_null (1); + nullhd[0] = ((flags & GPGRT_SPAWN_KEEP_STDIN)? + GetStdHandle (STD_INPUT_HANDLE) : w32_open_null (0)); + if (outpipe[1] == INVALID_HANDLE_VALUE) + nullhd[1] = ((flags & GPGRT_SPAWN_KEEP_STDOUT)? + GetStdHandle (STD_OUTPUT_HANDLE) : w32_open_null (1)); + if (errpipe[1] == INVALID_HANDLE_VALUE) + nullhd[2] = ((flags & GPGRT_SPAWN_KEEP_STDOUT)? + GetStdHandle (STD_ERROR_HANDLE) : w32_open_null (1)); /* Start the process. Note that we can't run the PREEXEC function because this might change our own environment. */ -- cgit v1.2.3