Applied patch [ 1586964 ] Getting the PID of the process executed by wxProcess::Open()

by Lauri Nurmi


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-10-30 09:03:18 +00:00
parent 4a4bf7eefb
commit a387938f80
4 changed files with 18 additions and 1 deletions

View File

@@ -49,6 +49,7 @@ void wxProcess::Init(wxEvtHandler *parent, int id, int flags)
SetNextHandler(parent);
m_id = id;
m_pid = 0;
m_redirect = (flags & wxPROCESS_REDIRECT) != 0;
#if wxUSE_STREAMS
@@ -63,13 +64,16 @@ wxProcess *wxProcess::Open(const wxString& cmd, int flags)
{
wxASSERT_MSG( !(flags & wxEXEC_SYNC), wxT("wxEXEC_SYNC should not be used." ));
wxProcess *process = new wxProcess(wxPROCESS_REDIRECT);
if ( !wxExecute(cmd, flags, process) )
long pid = wxExecute(cmd, flags, process);
if( !pid )
{
// couldn't launch the process
delete process;
return NULL;
}
process->SetPid(pid);
return process;
}