From 803d40a63f9dc9c5533cb39823d07108c6b31665 Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Mon, 12 Dec 2016 09:33:05 +0100 Subject: [PATCH] Make child process PID accessible via wxProcess in wxMSW too For consistency with the Unix version, call wxProcess::SetPid() even when executing the child process synchronously in wxMSW too. This allows code dispatching events during synchronous execution to access the PID of the child, if needed. Closes https://github.com/wxWidgets/wxWidgets/pull/369 --- src/msw/utilsexc.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 43a88d98af..e4d6d0c28f 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -918,6 +918,10 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, data->dwProcessId = pi.dwProcessId; data->hWnd = hwnd; data->state = (flags & wxEXEC_SYNC) != 0; + + if ( handler ) + handler->SetPid(pi.dwProcessId); + if ( flags & wxEXEC_SYNC ) { // handler may be !NULL for capturing program output, but we don't use @@ -930,9 +934,6 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, { // may be NULL or not data->handler = handler; - - if (handler) - handler->SetPid(pi.dwProcessId); } DWORD tid;