libcamgm
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
src
ca-mgm
ExternalProgram.hpp
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
13
#ifndef CA_MGM_EXTERNALPROGRAM_H
14
#define CA_MGM_EXTERNALPROGRAM_H
15
16
#include <map>
17
#include <string>
18
#include <vector>
19
20
#include <
ca-mgm/ExternalDataSource.hpp
>
21
#include <
ca-mgm/PathName.hpp
>
22
23
namespace
ca_mgm {
24
56
class
ExternalProgram
:
public
ExternalDataSource
57
{
58
59
public
:
60
61
typedef
std::vector<std::string>
Arguments
;
62
67
enum
Stderr_Disposition
{
68
Normal_Stderr
,
69
Discard_Stderr
,
70
Stderr_To_Stdout
,
71
Stderr_To_FileDesc
72
};
73
74
78
typedef
std::map<std::string,std::string>
Environment
;
79
88
ExternalProgram
(std::string commandline,
89
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
90
bool
use_pty
=
false
,
int
stderr_fd = -1,
bool
default_locale =
false
,
91
const
path::PathName
& root =
""
);
92
100
ExternalProgram
();
101
102
ExternalProgram
(
const
Arguments
&argv,
103
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
104
bool
use_pty
=
false
,
int
stderr_fd = -1,
bool
default_locale =
false
,
105
const
path::PathName
& root =
""
);
106
107
ExternalProgram
(
const
Arguments
&argv,
const
Environment
& environment,
108
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
109
bool
use_pty
=
false
,
int
stderr_fd = -1,
bool
default_locale =
false
,
110
const
path::PathName
& root =
""
);
111
112
ExternalProgram
(
const
char
*
const
*argv,
113
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
114
bool
use_pty
=
false
,
int
stderr_fd = -1,
bool
default_locale =
false
,
115
const
path::PathName
& root =
""
);
116
117
ExternalProgram
(
const
char
*
const
*argv,
const
Environment
& environment,
118
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
119
bool
use_pty
=
false
,
int
stderr_fd = -1,
bool
default_locale =
false
,
120
const
path::PathName
& root =
""
);
121
122
ExternalProgram
(
const
char
*binpath,
const
char
*
const
*argv_1,
123
bool
use_pty
=
false
);
124
125
126
ExternalProgram
(
const
char
*binpath,
const
char
*
const
*argv_1,
const
Environment
& environment,
127
bool
use_pty
=
false
);
128
129
130
~ExternalProgram
();
131
132
int
close
();
133
137
bool
kill
();
138
142
bool
running
();
143
147
pid_t
getpid
() {
return
pid
; }
148
150
const
std::string &
command
()
const
151
{
return
_command
; }
152
162
const
std::string &
execError
()
const
163
{
return
_execError
; }
164
168
static
void
renumber_fd
(
int
origfd,
int
newfd);
169
170
protected
:
171
int
checkStatus
(
int
);
172
173
private
:
174
179
bool
use_pty
;
180
181
pid_t
pid
;
182
int
_exitStatus
;
184
std::string
_command
;
186
std::string
_execError
;
187
188
void
start_program
(
const
char
*
const
*argv,
const
Environment
& environment,
189
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
190
int
stderr_fd = -1,
bool
default_locale =
false
,
191
const
char
* root = NULL);
192
193
};
194
195
}
// namespace ca_mgm
196
197
#endif // CA_MGM_EXTERNALPROGRAM_H
Generated by
1.8.2