forked from spillz/codeblocks-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasyncprocess.h
More file actions
35 lines (31 loc) · 942 Bytes
/
asyncprocess.h
File metadata and controls
35 lines (31 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef ASYNCPROCESS_H_INCLUDED
#define ASYNCPROCESS_H_INCLUDED
#include <wx/wx.h>
#include <wx/process.h>
//Runs a child process asynchronously with output + error redirected, posting a message to the parent when complete
class AsyncProcess: public wxEvtHandler
{
public:
AsyncProcess(wxEvtHandler *parent)
{
m_parent=parent;
m_exec_proc=NULL;
return;
}
~AsyncProcess();
int Exec(const wxString &command);
wxString GetStdout() {return m_exec_output;}
wxString GetStderr() {return m_exec_err;}
void OnExecTerminate(wxProcessEvent &e);
void OnExecTimer(wxTimerEvent &e);
private:
wxProcess *m_exec_proc;
wxInputStream *m_exec_stream, *m_exec_errstream;
int m_exec_proc_id;
wxTimer *m_exec_timer;
wxString m_exec_output, m_exec_err;
void ReadStream(bool all=false);
wxEvtHandler *m_parent;
DECLARE_EVENT_TABLE()
};
#endif //ASYNCPROCESS_H_INCLUDED