From aca2605cb8a04ac063fe37b14cc303522a0ccd81 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Thu, 2 Aug 2018 17:40:20 +0100 Subject: [PATCH] #6383 Capture process output when in foreground mode --- src/lib/platform/MSWindowsWatchdog.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/platform/MSWindowsWatchdog.cpp b/src/lib/platform/MSWindowsWatchdog.cpp index f3509b83..ad63c93c 100644 --- a/src/lib/platform/MSWindowsWatchdog.cpp +++ b/src/lib/platform/MSWindowsWatchdog.cpp @@ -357,12 +357,17 @@ MSWindowsWatchdog::startProcessInForeground(String& command) // clear, as we're reusing process info struct ZeroMemory(&m_processInfo, sizeof(PROCESS_INFORMATION)); - STARTUPINFO startupInfo; - ZeroMemory(&startupInfo, sizeof(STARTUPINFO)); + STARTUPINFO si; + ZeroMemory(&si, sizeof(STARTUPINFO)); + si.cb = sizeof(STARTUPINFO); + si.lpDesktop = "winsta0\\Default"; // TODO: maybe this should be \winlogon if we have logonui.exe? + si.hStdError = m_stdOutWrite; + si.hStdOutput = m_stdOutWrite; + si.dwFlags |= STARTF_USESTDHANDLES; return CreateProcess( NULL, LPSTR(command.c_str()), NULL, NULL, - FALSE, 0, NULL, NULL, &startupInfo, &m_processInfo); + TRUE, 0, NULL, NULL, &si, &m_processInfo); } BOOL