aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-06-06 04:21:31 +0000
committerNIIBE Yutaka <[email protected]>2024-06-06 04:21:31 +0000
commit03fd278d7f7a1e3e0d082de5efb9d85740cf0ab8 (patch)
tree616c75d077888464e3385809bc63c17135bcf566
parentCleanup spawn API implementation. (diff)
downloadlibgpg-error-03fd278d7f7a1e3e0d082de5efb9d85740cf0ab8.tar.gz
libgpg-error-03fd278d7f7a1e3e0d082de5efb9d85740cf0ab8.zip
spawn: Add new GPGRT_PROCESS_NO_CONSOLE for Windows.
* src/gpg-error.h.in (GPGRT_PROCESS_NO_CONSOLE): New. * src/spawn-w32.c (_gpgrt_process_spawn): Handle GPGRT_PROCESS_NO_CONSOLE. -- This may be used to support ASSUAN_PIPE_CONNECT_DETACHED in libassuan. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--src/gpg-error.h.in4
-rw-r--r--src/spawn-w32.c1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index 4e982fc..0af8ef5 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -1089,8 +1089,12 @@ void _gpgrt_log_assert (const char *expr, const char *file, int line,
/*
* Spawn functions
*/
+/* Child process is detached to parent process. */
#define GPGRT_PROCESS_DETACHED (1 << 1)
+/* Child process has no console (Windows only). */
+#define GPGRT_PROCESS_NO_CONSOLE (1 << 2)
+
/* Specify how to keep/connect standard fds. */
#define GPGRT_PROCESS_STDIN_PIPE (1 << 8)
#define GPGRT_PROCESS_STDOUT_PIPE (1 << 9)
diff --git a/src/spawn-w32.c b/src/spawn-w32.c
index c6d66c7..8bc996a 100644
--- a/src/spawn-w32.c
+++ b/src/spawn-w32.c
@@ -785,6 +785,7 @@ _gpgrt_process_spawn (const char *pgmname, const char *argv[],
/* log_debug ("CreateProcess, path='%s' cmdline='%s'\n", pgmname, cmdline); */
cr_flags = (CREATE_DEFAULT_ERROR_MODE
+ | ((flags & GPGRT_PROCESS_NO_CONSOLE) ? DETACHED_PROCESS : 0)
| GetPriorityClass (GetCurrentProcess ())
| CREATE_SUSPENDED);
if (!(wpgmname = _gpgrt_utf8_to_wchar (pgmname)))