]>
git.saurik.com Git - wxWidgets.git/blob - src/common/process.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Process termination classes
4 // Author: Guilhem Lavaux
5 // Modified by: Vadim Zeitlin to check error codes, added Detach() method
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "process.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/process.h"
29 DEFINE_EVENT_TYPE(wxEVT_END_PROCESS
)
31 IMPLEMENT_DYNAMIC_CLASS(wxProcess
, wxEvtHandler
)
32 IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent
, wxEvent
)
34 void wxProcess::Init(wxEvtHandler
*parent
, int id
, bool redirect
)
37 SetNextHandler(parent
);
40 m_redirect
= redirect
;
45 m_outputStream
= NULL
;
46 #endif // wxUSE_STREAMS
49 wxProcess::~wxProcess()
54 delete m_outputStream
;
55 #endif // wxUSE_STREAMS
58 void wxProcess::OnTerminate(int pid
, int status
)
60 wxProcessEvent
event(m_id
, pid
, status
);
62 if ( !ProcessEvent(event
) )
64 //else: the object which processed the event is responsible for deleting
68 void wxProcess::Detach()
75 void wxProcess::SetPipeStreams(wxInputStream
*inputSstream
,
76 wxOutputStream
*outputStream
,
77 wxInputStream
*errorStream
)
79 m_inputStream
= inputSstream
;
80 m_errorStream
= errorStream
;
81 m_outputStream
= outputStream
;
84 #endif // wxUSE_STREAMS