diff options
author | LRN <lrn1986@gmail.com> | 2014-01-08 14:14:52 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2014-01-08 14:14:52 +0000 |
commit | 334fa9a6f8028aedc65b63e5704228a879e8629e (patch) | |
tree | bb39f146b6262180adcb36c19a8754a62d91e17f /src/util/os_priority.c | |
parent | 6ac69cc9d64d34df69613f717caa83fa6e75f5ab (diff) | |
download | gnunet-334fa9a6f8028aedc65b63e5704228a879e8629e.tar.gz gnunet-334fa9a6f8028aedc65b63e5704228a879e8629e.zip |
Fix W32 process spawning to use CREATE_NO_WINDOW only when there's no console
Diffstat (limited to 'src/util/os_priority.c')
-rw-r--r-- | src/util/os_priority.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index c1ee08728..23eb1d168 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -753,6 +753,7 @@ start_process (int pipe_control, | |||
753 | DWORD stdif, stdof, stdef; | 753 | DWORD stdif, stdof, stdef; |
754 | BOOL bresult; | 754 | BOOL bresult; |
755 | DWORD error_code; | 755 | DWORD error_code; |
756 | DWORD create_no_window; | ||
756 | 757 | ||
757 | if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename, GNUNET_NO, NULL)) | 758 | if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename, GNUNET_NO, NULL)) |
758 | return NULL; /* not executable */ | 759 | return NULL; /* not executable */ |
@@ -1051,8 +1052,17 @@ start_process (int pipe_control, | |||
1051 | return NULL; | 1052 | return NULL; |
1052 | } | 1053 | } |
1053 | 1054 | ||
1055 | create_no_window = 0; | ||
1056 | { | ||
1057 | HANDLE console_input = CreateFile ("CONIN$", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); | ||
1058 | if (INVALID_HANDLE_VALUE == console_input) | ||
1059 | create_no_window = CREATE_NO_WINDOW; | ||
1060 | else | ||
1061 | CloseHandle (console_input); | ||
1062 | } | ||
1063 | |||
1054 | bresult = CreateProcessW (wpath, wcmd, NULL, NULL, GNUNET_YES, | 1064 | bresult = CreateProcessW (wpath, wcmd, NULL, NULL, GNUNET_YES, |
1055 | CREATE_SUSPENDED, env_block, NULL, &start, &proc); | 1065 | create_no_window | CREATE_SUSPENDED, env_block, NULL, &start, &proc); |
1056 | error_code = GetLastError (); | 1066 | error_code = GetLastError (); |
1057 | 1067 | ||
1058 | if ((NULL == pipe_stdin) && (stdih)) | 1068 | if ((NULL == pipe_stdin) && (stdih)) |