29 #ifndef PT_SYSTEM_PROCESS_H
30 #define PT_SYSTEM_PROCESS_H
32 #include <Pt/System/Api.h>
33 #include <Pt/System/Path.h>
34 #include <Pt/System/IODevice.h>
35 #include <Pt/System/SystemError.h>
36 #include <Pt/NonCopyable.h>
90 { _args.push_back(argument);
return *
this; }
95 {
return _args.size(); }
99 const std::string&
arg(std::size_t idx)
const
100 {
return _args.at(idx); }
115 { _stdinMode = mode; }
130 { _stdoutMode = mode; }
145 { _stderrMode = mode; }
164 std::vector<std::string> _args;
216 bool tryWait(
int& status);
228 class ProcessImpl *_impl;
245 #endif // PT_SYSTEM_PROCESS_H
void setDetached(bool sw)
Process should detach.
Definition: Process.h:109
Protects derived classes from being copied.
Definition: NonCopyable.h:54
ProcessInfo & addArg(const std::string &argument)
Adds an argument to the list of arguments.
Definition: Process.h:89
Keep open.
Definition: Process.h:72
bool isStdErrorAsOutput() const
Returns true if stderr and atdout wil be combined.
Definition: Process.h:159
Represents a path in the file-system.
Definition: Path.h:47
~ProcessFailed()
Destructor.
Definition: Process.h:59
void setStdError(IOMode mode)
Sets I/O flags for stderr.
Definition: Process.h:144
Close I/O.
Definition: Process.h:73
Combine stderr with stdout, only valid for stderr.
Definition: Process.h:75
bool isStdInputClosed() const
Returns true if stdin will be closed.
Definition: Process.h:119
Redirect I/O.
Definition: Process.h:74
bool isStdErrorClosed() const
Returns true if stderr will be closed.
Definition: Process.h:149
ProcessInfo(const Path &command)
Construct with command to execute.
Definition: Process.h:232
bool isStdErrorRedirected() const
Returns true if stderr will be redirected.
Definition: Process.h:154
const std::string & arg(std::size_t idx) const
Returns a command line argument.
Definition: Process.h:99
std::size_t argCount() const
Number of command line arguments.
Definition: Process.h:94
bool isStdOutputRedirected() const
Returns true if stdout will be redirected.
Definition: Process.h:139
bool isStdOutputClosed() const
Returns true if stdout will be closed.
Definition: Process.h:134
void setStdInput(IOMode mode)
Sets I/O flags for stdin.
Definition: Process.h:114
Endpoint for I/O operations.
Definition: IODevice.h:55
Exception class indication a system error.
Definition: SystemError.h:42
const Path & command() const
Command to execute.
Definition: Process.h:84
void setStdOutput(IOMode mode)
Sets I/O flags for stdout.
Definition: Process.h:129
State
State of the process.
Definition: Process.h:177
Executes shell commands.
Definition: Process.h:172
Process startup parameters
Definition: Process.h:65
bool isStdInputRedirected() const
Returns true if stdin will be redirected.
Definition: Process.h:124
Indicates process failure.
Definition: Process.h:50
bool isDetached() const
Returns true if process should detach.
Definition: Process.h:104
IOMode
Flags for process I/O.
Definition: Process.h:70