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
This commit is contained in:
nicolas-f
2016-12-12 09:33:05 +01:00
committed by Vadim Zeitlin
parent 04428890b7
commit 803d40a63f

View File

@@ -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;