21 #ifndef G_NEW_PROCESS_H
22 #define G_NEW_PROCESS_H
47 G_EXCEPTION( ChildError ,
"child process terminated abnormally or stopped" ) ;
48 G_EXCEPTION( Insecure ,
"refusing to exec() while the user-id is zero" ) ;
50 G_EXCEPTION( InvalidPath ,
"invalid executable path -- must be absolute" ) ;
51 G_EXCEPTION( NoExtension ,
"refusing to CreateProcess() without a file extension such as .exe" ) ;
54 class ChildProcessImp ;
63 public: std::string
read() ;
76 std::string * pipe_result_p = NULL ,
int error_return = 127 ,
77 std::string (*error_decode_fn)(
int) = 0 ) ;
99 static int wait(
const Process::Id & child ,
int error_return ) ;
100 static int execCore(
const Path & ,
const Strings & ) ;
static int spawn(Identity nobody, const Path &exe, const Strings &args, std::string *pipe_result_p=NULL, int error_return=127, std::string(*error_decode_fn)(int)=0)
Runs a command in an unprivileged child process.
void operator=(const ChildProcess &)
std::list< std::string > Strings
A std::list of std::strings.
A very low-level interface to getpwnam() and the get/set/e/uid/gid functions.
Represents the state of a child process.
static Who fork()
Forks a child process.
A private implementation class used by G::NewProcess.
#define G_EXCEPTION(class_name, description)
define as a function rather than a type if optimising for size
A Path object represents a file system path.
A static interface for creating new processes.