blocxx
Classes | Namespaces | Enumerations | Functions | Variables

Exec.hpp File Reference

#include "blocxx/BLOCXX_config.h"
#include "blocxx/CommonFwd.hpp"
#include "blocxx/EnvVars.hpp"
#include "blocxx/Process.hpp"
#include "blocxx/Process.hpp"

Go to the source code of this file.

Classes

class  BLOCXX_NAMESPACE::Exec::PreExec
 This class is used to specify what spawn() should do between fork and exec. More...
struct  BLOCXX_NAMESPACE::Exec::PreExec::Error
struct  BLOCXX_NAMESPACE::Exec::PreExec::DontCatch
 Use this class to allow call() to throw an exception. More...
class  BLOCXX_NAMESPACE::Exec::OutputCallback
class  BLOCXX_NAMESPACE::Exec::InputCallback
struct  BLOCXX_NAMESPACE::Exec::Impl::NullFactory

Namespaces

namespace  BLOCXX_NAMESPACE
 

Taken from RFC 1321.


namespace  BLOCXX_NAMESPACE::Exec
namespace  BLOCXX_NAMESPACE::Exec::Impl

Enumerations

enum  BLOCXX_NAMESPACE::Exec::EOutputSource { BLOCXX_NAMESPACE::Exec::E_STDOUT, BLOCXX_NAMESPACE::Exec::E_STDERR }

Functions

 BLOCXX_NAMESPACE::BLOCXX_DECLARE_APIEXCEPTION (ExecError, BLOCXX_COMMON_API)
 BLOCXX_NAMESPACE::BLOCXX_DECLARE_APIEXCEPTION2 (ExecTimeout, ExecErrorException, BLOCXX_COMMON_API)
 BLOCXX_NAMESPACE::BLOCXX_DECLARE_APIEXCEPTION2 (ExecBufferFull, ExecErrorException, BLOCXX_COMMON_API)
Process::Status BLOCXX_NAMESPACE::Exec::system (const Array< String > &command, const char *const envp[]=0, const Timeout &=Timeout::infinite)
 Execute a command.
template<typename SA1 , typename SA2 >
Process::Status BLOCXX_NAMESPACE::Exec::system (const SA1 &command, const SA2 &envVars, const Timeout &timeout=Timeout::infinite)
int BLOCXX_NAMESPACE::Exec::safeSystem (const Array< String > &command, const char *const envp[]=0) BLOCXX_DEPRECATED
 This is deprecated.
ProcessRef BLOCXX_NAMESPACE::Exec::spawn (char const *exec_path, char const *const argv[], char const *const envp[], PreExec &pre_exec)
 Run the executable exec_path in a child process, with argv for the program arguments and envp for the environment.
template<typename S , typename SA1 , typename SA2 >
ProcessRef BLOCXX_NAMESPACE::Exec::spawn (S const &exec_path, SA1 const &argv, SA2 const &envp, PreExec &pre_exec)
 Variant of spawn that allows exec_path to have an arbitrary string-like type, and argv and envp to have arbitrary string-array-like types.
ProcessRef BLOCXX_NAMESPACE::Exec::spawn (char const *const argv[], char const *const envp[])
 Variant of spawn that uses StandardPreExec.
template<typename SA1 , typename SA2 >
ProcessRef BLOCXX_NAMESPACE::Exec::spawn (SA1 const &argv, SA2 const &envp)
 Variant of spawn that uses StandardPreExec and argv and envp to have arbitrary string-array-like types.
template<typename SA1 >
ProcessRef BLOCXX_NAMESPACE::Exec::spawn (SA1 const &argv)
void BLOCXX_NAMESPACE::Exec::gatherOutput (String &output, const ProcessRef &proc, const Timeout &timeout=Timeout::infinite, int outputlimit=-1)
 Wait for output from a child process.
void BLOCXX_NAMESPACE::Exec::processInputOutput (OutputCallback &output, Array< ProcessRef > &procs, InputCallback &input, const Timeout &timeout=Timeout::infinite)
 Send input and wait for output from child processes.
void BLOCXX_NAMESPACE::Exec::processInputOutput (const String &input, String &output, const ProcessRef &process, const Timeout &timeout, int outputLimit)
Process::Status BLOCXX_NAMESPACE::Exec::feedProcessAndGatherOutput (ProcessRef const &proc, String &output, Timeout const &timeout=Timeout::infinite, int outputlimit=-1, String const &input=String())
 Send input to a process, collect the output, and wait for it to exit.
Process::Status BLOCXX_NAMESPACE::Exec::feedProcessAndGatherOutput (ProcessRef const &proc, String &output, String &erroutput, Timeout const &timeout=Timeout::infinite, int outputLimit=-1, String const &input=String())
 Send input to a process, collect STDOUT and STDERR, and wait for it to exit.
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (char const *const command[], String &output, char const *const envVars[], const Timeout &timeout=Timeout::infinite, int outputlimit=-1, char const *input=0)
 Execute a command and run feedProcessAndGatherOutput() on the process.
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (char const *const command[], String &output, String &erroutput, char const *const envVars[], const Timeout &timeout=Timeout::infinite, int outputLimit=-1, char const *input=0)
 Execute a command and run feedProcessAndGatherOutput() on the process.
template<typename SA1 , typename S1 , typename S2 >
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (SA1 const &command, S1 &output, const Timeout &timeout, int outputlimit, S2 const &input)
 Version of executeProcessAndGatherOutput() that passes the current process's environment to the child process.
template<typename SA1 , typename S1 , typename S2 >
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (SA1 const &command, S1 &output, S1 &erroutput, const Timeout &timeout, int outputlimit, S2 const &input)
 Version of executeProcessAndGatherOutput() that passes the current process's environment to the child process and separates STDOUT and STDERR.
template<typename SA1 , typename S1 >
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (SA1 const &command, S1 &output, const Timeout &timeout=Timeout::infinite, int outputlimit=-1)
 Version of executeProcessAndGatherOutput() that passes the current process's environment to the child process.
template<typename SA1 , typename S1 >
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (SA1 const &command, S1 &output, S1 &erroutput, const Timeout &timeout=Timeout::infinite, int outputlimit=-1)
 Version of executeProcessAndGatherOutput() that passes the current process's environment to the child process and collects STDOUT and STDERR separately.
template<typename SA1 , typename S1 , typename SA2 , typename S2 >
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (SA1 const &command, S1 &output, SA2 const &envp, const Timeout &timeout, int outputlimit, S2 const &input)
 Variant of executeProcessAndGatherOutput that allows command and envp to have arbitrary string-array-like types and output to have an arbitrary string-like type.
template<typename SA1 , typename S1 , typename SA2 , typename S2 >
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (SA1 const &command, S1 &output, S1 &erroutput, SA2 const &envp, const Timeout &timeout, int outputlimit, S2 const &input)
 Variant of executeProcessAndGatherOutput that allows command and envp to have arbitrary string-array-like types and output to have an arbitrary string-like type.
template<typename SA1 , typename S1 , typename SA2 >
Process::Status BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (SA1 const &command, S1 &output, S1 &erroutput, SA2 const &envp, const Timeout &timeout=Timeout::infinite, int outputlimit=-1)
 Version of executeProcessAndGatherOutput() that passes no input to the process.
BLOCXX_COMMON_API void BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput (const Array< String > &command, String &output, int &processstatus, int timeoutsecs, int outputlimit, const String &input)
void BLOCXX_NAMESPACE::Exec::Impl::close_child_ends (UnnamedPipeRef ppipe[BLOCXX_NPIPE])

Variables

static char const *const const BLOCXX_NAMESPACE::Exec::currentEnvironment = 0
 Intended to be used as a parameter to spawn() to indicate that the current environment will be used for the child process.
unsigned const BLOCXX_NAMESPACE::Exec::Impl::BLOCXX_IN = 0
unsigned const BLOCXX_NAMESPACE::Exec::Impl::BLOCXX_OUT = 1
unsigned const BLOCXX_NAMESPACE::Exec::Impl::BLOCXX_SERR = 2
unsigned const BLOCXX_NAMESPACE::Exec::Impl::BLOCXX_EXEC_ERR = 3
unsigned const BLOCXX_NAMESPACE::Exec::Impl::BLOCXX_NPIPE = 4