summaryrefslogtreecommitdiffstats
path: root/ipc/chromium/src
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-08-29 20:35:26 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-08-29 20:35:26 +0200
commit0bc2511432fe0cdcae92aae71576b6eb9bad7f5c (patch)
tree3c8abf046c37875b1116465332b717bc3ab3d6b1 /ipc/chromium/src
parent693656e99bf4a7e3a495472cef142411cfd332a1 (diff)
downloadUXP-0bc2511432fe0cdcae92aae71576b6eb9bad7f5c.tar
UXP-0bc2511432fe0cdcae92aae71576b6eb9bad7f5c.tar.gz
UXP-0bc2511432fe0cdcae92aae71576b6eb9bad7f5c.tar.lz
UXP-0bc2511432fe0cdcae92aae71576b6eb9bad7f5c.tar.xz
UXP-0bc2511432fe0cdcae92aae71576b6eb9bad7f5c.zip
Fix incorrect code removal in ipc.
Follow-up to a930db1c9e8444ed89754c5a79085d59c7295952
Diffstat (limited to 'ipc/chromium/src')
-rw-r--r--ipc/chromium/src/base/process_util_win.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/ipc/chromium/src/base/process_util_win.cc b/ipc/chromium/src/base/process_util_win.cc
index f22f7216f..fa9b86ace 100644
--- a/ipc/chromium/src/base/process_util_win.cc
+++ b/ipc/chromium/src/base/process_util_win.cc
@@ -298,6 +298,33 @@ bool LaunchApp(const std::wstring& cmdline,
LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList = NULL;
+ // setup our handle array first - if we end up with no handles that can
+ // be inherited we can avoid trying to do the ThreadAttributeList dance...
+ HANDLE handlesToInherit[2];
+ int handleCount = 0;
+ HANDLE stdOut = ::GetStdHandle(STD_OUTPUT_HANDLE);
+ HANDLE stdErr = ::GetStdHandle(STD_ERROR_HANDLE);
+
+ if (IsInheritableHandle(stdOut))
+ handlesToInherit[handleCount++] = stdOut;
+ if (stdErr != stdOut && IsInheritableHandle(stdErr))
+ handlesToInherit[handleCount++] = stdErr;
+
+ if (handleCount) {
+ lpAttributeList = CreateThreadAttributeList(handlesToInherit, handleCount);
+ if (lpAttributeList) {
+ // it's safe to inherit handles, so arrange for that...
+ startup_info.cb = sizeof(startup_info_ex);
+ startup_info.dwFlags |= STARTF_USESTDHANDLES;
+ startup_info.hStdOutput = stdOut;
+ startup_info.hStdError = stdErr;
+ startup_info.hStdInput = INVALID_HANDLE_VALUE;
+ startup_info_ex.lpAttributeList = lpAttributeList;
+ dwCreationFlags |= EXTENDED_STARTUPINFO_PRESENT;
+ bInheritHandles = TRUE;
+ }
+ }
+
PROCESS_INFORMATION process_info;
BOOL createdOK = CreateProcess(NULL,
const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL,