-
Notifications
You must be signed in to change notification settings - Fork 91
/
Execute.h
58 lines (47 loc) · 1.69 KB
/
Execute.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*******************************************************************************
*
* Copyright (C) 2009, Alexander Stigsen, e-texteditor.com
*
* This software is licensed under the Open Company License as described
* in the file license.txt, which you should have received as part of this
* distribution. The terms are also available at http://opencompany.org/license.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
******************************************************************************/
#ifndef __EXECPROCESS_H__
#define __EXECPROCESS_H__
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include <wx/event.h>
#endif
#include <vector>
class cxEnv;
class wxProcessEvent;
class cxExecute : public wxEvtHandler {
public:
cxExecute(const cxEnv& env, const wxString& cwd=wxEmptyString):
m_threadDone(false), m_env(env), m_cwd(cwd), m_debugLog(false), m_showWindow(false), m_updateWindow(true) {};
int Execute(const wxString& command);
int Execute(const wxString& command, const std::vector<char>& input);
std::vector<char>& GetOutput() {return m_output;};
std::vector<char>& GetErrorOut() {return m_errout;};
void SetDebugLogging(bool doLog) {m_debugLog = doLog;};
void SetShowWindow(bool doShow) {m_showWindow = doShow;};
void SetUpdateWindow(bool doUpdate) {m_updateWindow = doUpdate;};
void ThreadDone(int exitCode);
private:
void OnEndProcess(wxProcessEvent& event);
DECLARE_EVENT_TABLE();
bool m_threadDone;
int m_exitCode;
std::vector<char> m_output;
std::vector<char> m_errout;
const cxEnv& m_env;
const wxString& m_cwd;
bool m_debugLog;
bool m_showWindow;
bool m_updateWindow;
};
#endif // __EXECPROCESS_H__