Compare commits
3 Commits
process_in
...
process_in
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5d1b59b68 | ||
|
|
d921e2d7a3 | ||
|
|
4156771077 |
@@ -90,8 +90,11 @@ sc_process_execute_p(const char *const argv[], HANDLE *handle, unsigned inherit,
|
|||||||
HANDLE handles[3];
|
HANDLE handles[3];
|
||||||
|
|
||||||
LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList = NULL;
|
LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList = NULL;
|
||||||
|
// Must be set even if handle_count == 0, so that stdin, stdout and stderr
|
||||||
|
// are NOT inherited in that case
|
||||||
|
si.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
|
||||||
|
|
||||||
if (handle_count) {
|
if (handle_count) {
|
||||||
si.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
|
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
if (pin) {
|
if (pin) {
|
||||||
si.StartupInfo.hStdInput = stdin_read_handle;
|
si.StartupInfo.hStdInput = stdin_read_handle;
|
||||||
@@ -152,9 +155,7 @@ sc_process_execute_p(const char *const argv[], HANDLE *handle, unsigned inherit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOL bInheritHandles = handle_count > 0;
|
BOOL bInheritHandles = handle_count > 0;
|
||||||
// DETACHED_PROCESS to disable stdin, stdout and stderr
|
DWORD dwCreationFlags = handle_count > 0 ? EXTENDED_STARTUPINFO_PRESENT : 0;
|
||||||
DWORD dwCreationFlags = handle_count == 0 ? DETACHED_PROCESS
|
|
||||||
: EXTENDED_STARTUPINFO_PRESENT;
|
|
||||||
BOOL ok = CreateProcessW(NULL, wide, NULL, NULL, bInheritHandles,
|
BOOL ok = CreateProcessW(NULL, wide, NULL, NULL, bInheritHandles,
|
||||||
dwCreationFlags, NULL, NULL, &si.StartupInfo, &pi);
|
dwCreationFlags, NULL, NULL, &si.StartupInfo, &pi);
|
||||||
free(wide);
|
free(wide);
|
||||||
|
|||||||
Reference in New Issue
Block a user