yast2-core
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
liby2util-r
src
include
y2util
ExternalProgram.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| |
3
| __ __ ____ _____ ____ |
4
| \ \ / /_ _/ ___|_ _|___ \ |
5
| \ V / _` \___ \ | | __) | |
6
| | | (_| |___) || | / __/ |
7
| |_|\__,_|____/ |_| |_____| |
8
| |
9
| core system |
10
| (C) SuSE GmbH |
11
\----------------------------------------------------------------------/
12
13
File: ExternalProgram.h
14
15
Author: Andreas Schwab <schwab@suse.de>
16
Maintainer: Thomas Roelz <tom@suse.de>
17
18
/-*/
19
20
#ifndef ExternalProgram_h
21
#define ExternalProgram_h
22
23
#include <map>
24
#include <string>
25
26
#include <
y2util/ExternalDataSource.h
>
27
#include <
y2util/Pathname.h
>
28
36
class
ExternalProgram
:
public
ExternalDataSource
37
{
38
39
public
:
44
enum
Stderr_Disposition
{
45
Normal_Stderr
,
46
Discard_Stderr
,
47
Stderr_To_Stdout
,
48
Stderr_To_FileDesc
49
};
50
54
typedef
std::map<std::string,std::string>
Environment
;
55
64
ExternalProgram
(std::string commandline,
65
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
66
bool
use_pty
=
false
,
int
stderr_fd = -1,
bool
default_locale =
false
,
67
const
Pathname
& root =
""
,
bool
pty_trans =
true
);
68
74
ExternalProgram
(
const
char
*
const
*argv,
75
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
76
bool
use_pty
=
false
,
int
stderr_fd = -1,
bool
default_locale =
false
,
77
const
Pathname
& root =
""
,
bool
pty_trans =
true
);
78
79
ExternalProgram
(
const
char
*
const
*argv,
const
Environment
& environment,
80
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
81
bool
use_pty
=
false
,
int
stderr_fd = -1,
bool
default_locale =
false
,
82
const
Pathname
& root =
""
,
bool
pty_trans =
true
);
83
84
ExternalProgram
(
const
char
*binpath,
const
char
*
const
*argv_1,
85
bool
use_pty
=
false
,
bool
pty_trans =
true
);
86
87
88
ExternalProgram
(
const
char
*binpath,
const
char
*
const
*argv_1,
const
Environment
& environment,
89
bool
use_pty
=
false
,
bool
pty_trans =
true
);
90
91
92
~ExternalProgram
();
93
94
int
close
();
95
99
bool
kill
();
100
104
bool
running
();
105
109
pid_t
getpid
() {
return
pid
; }
110
114
static
void
renumber_fd
(
int
origfd,
int
newfd);
115
116
protected
:
117
int
checkStatus
(
int
);
118
119
private
:
120
125
bool
use_pty
;
126
131
bool
disable_pty_trans
;
132
133
pid_t
pid
;
134
int
_exitStatus
;
135
136
void
start_program
(
const
char
*
const
*argv,
const
Environment
& environment,
137
Stderr_Disposition
stderr_disp =
Normal_Stderr
,
138
int
stderr_fd = -1,
bool
default_locale =
false
,
139
const
char
* root = NULL);
140
141
// disable LF to CRLF translation on the terminal file descriptor
142
bool
disableCRLFTranslation
(
int
fd);
143
};
144
145
#endif // ExternalProgram_h
Generated on a sunny day for yast2-core by
1.8.2