DebugServer2
Loading...
Searching...
No Matches
ds2::Host::ProcessSpawner Class Reference
Collaboration diagram for ds2::Host::ProcessSpawner:

Classes

struct  RedirectDescriptor
 

Public Member Functions

bool setExecutable (std::string const &path)
 
bool setShellCommand (std::string const &command)
 
bool setWorkingDirectory (std::string const &path)
 
bool setArguments (StringCollection const &args)
 
template<typename... Args>
bool setArguments (Args const &... args)
 
bool setEnvironment (EnvironmentBlock const &env)
 
bool addEnvironment (std::string const &key, std::string const &val)
 
bool redirectInputToConsole ()
 
bool redirectOutputToConsole ()
 
bool redirectErrorToConsole ()
 
bool redirectInputToNull ()
 
bool redirectOutputToNull ()
 
bool redirectErrorToNull ()
 
bool redirectInputToFile (std::string const &path)
 
bool redirectOutputToFile (std::string const &path)
 
bool redirectErrorToFile (std::string const &path)
 
bool redirectOutputToBuffer ()
 
bool redirectErrorToBuffer ()
 
bool redirectInputToTerminal ()
 
bool redirectOutputToDelegate (RedirectDelegate delegate)
 
bool redirectErrorToDelegate (RedirectDelegate delegate)
 
ErrorCode run (std::function< bool()> preExecAction=[]() { return true;})
 
ErrorCode wait ()
 
bool isRunning () const
 
void flushAndExit ()
 
ProcessId pid () const
 
int exitStatus () const
 
int signalCode () const
 
std::string const & executable () const
 
StringCollection const & arguments () const
 
EnvironmentBlock const & environment () const
 
ErrorCode input (ByteVector const &buf)
 
std::string const & output () const
 
 ProcessSpawner (const ProcessSpawner &)=delete
 
ProcessSpawneroperator= (const ProcessSpawner &)=delete
 
bool setExecutable (const std::string &path)
 
bool setShellCommand (const std::string &command)
 
bool setWorkingDirectory (const std::string &path)
 
bool setArguments (const StringCollection &args)
 
template<typename... Args>
bool setArguments (const Args &...args)
 
bool setEnvironment (const EnvironmentBlock &args)
 
bool addEnvironment (const std::string &key, const std::string &val)
 
void setDebugOnCreate (bool debug)
 
bool redirectInputToConsole ()
 
bool redirectOutputToConsole ()
 
bool redirectErrorToConsole ()
 
bool redirectInputToNull ()
 
bool redirectOutputToNull ()
 
bool redirectErrorToNull ()
 
bool redirectInputToFile (const std::string &path)
 
bool redirectOutputToFile (const std::string &path)
 
bool redirectErrorToFile (const std::string &path)
 
bool redirectOutputToBuffer ()
 
bool redirectErrorToBuffer ()
 
bool redirectInputToTerminal ()
 
bool redirectOutputToDelegate (RedirectDelegate delegate)
 
bool redirectErrorToDelegate (RedirectDelegate delegate)
 
ErrorCode run (std::function< bool()> preExecAction=[]() { return true;})
 
ErrorCode wait ()
 
bool isRunning () const
 
void flushAndExit ()
 
ProcessId pid () const
 
HANDLE handle () const
 
ThreadId tid () const
 
HANDLE threadHandle () const
 
int exitStatus () const
 
int signalCode () const
 
const std::string & executable () const
 
const StringCollection & arguments () const
 
const EnvironmentBlock & environment () const
 
ErrorCode input (const ByteVector &buf)
 
const std::string & output () const
 

Protected Types

enum  RedirectMode {
  kRedirectUnset , kRedirectConsole , kRedirectNull , kRedirectFile ,
  kRedirectBuffer , kRedirectDelegate , kRedirectTerminal , unset ,
  console , null , file , buffer
}
 
enum class  RedirectMode {
  kRedirectUnset , kRedirectConsole , kRedirectNull , kRedirectFile ,
  kRedirectBuffer , kRedirectDelegate , kRedirectTerminal , unset ,
  console , null , file , buffer
}
 
enum class  StreamIndex { input , output , error , count }
 
typedef std::function< void(void *buf, size_t size)> RedirectDelegate
 

Static Protected Member Functions

static constexpr size_t Index (StreamIndex stream)
 

Protected Attributes

std::string _executablePath
 
StringCollection _arguments
 
EnvironmentBlock _environment
 
std::string _workingDirectory
 
std::thread _delegateThread
 
RedirectDescriptor _descriptors [3]
 
std::string _outputBuffer
 
int _exitStatus
 
int _signalCode
 
ProcessId _pid
 
bool _shell
 
std::string _rawTrailingArgument
 
bool _environmentSet
 
std::array< RedirectDescriptor, kStreamCount > _descriptors
 
std::array< std::thread, kStreamCount > _redirectThreads
 
std::mutex _outputBufferMutex
 
bool _debugOnCreate
 
HANDLE _handle
 
ThreadId _tid
 
HANDLE _threadHandle
 

Static Protected Attributes

static constexpr size_t kStreamCount
 

Member Data Documentation

◆ kStreamCount

size_t ds2::Host::ProcessSpawner::kStreamCount
staticconstexprprotected
Initial value:
=
static_cast<size_t>(StreamIndex::count)

The documentation for this class was generated from the following files: