tfel
Loading...
Searching...
No Matches
tfel::system::ProcessManager Struct Reference

a class used to handle external processes More...

#include </home/runner/work/tfel/tfel/include/TFEL/System/ProcessManager.hxx>

Classes

struct  Command
 base class to pass commands to sub processes More...

Public Types

enum  RedirectionType { None , StdIn , StdOut , StdInAndOut }
using ProcessId = pid_t
 a simple alias
using StreamId = int
 a simple alias
using rstream = rstreamView<true>
 a simple alias
using wstream = wstreamView<true>
 a simple alias

Public Member Functions

void stopOnSignals (const bool)
virtual void killProcess (const ProcessId)
virtual void sendSignal (const ProcessId, const int=SIGTERM)
virtual ProcessId createProcess (const std::string &, const RedirectionType=None)
virtual ProcessId createProcess (const std::string &, const std::string &, const std::string &, const std::string &, const std::map< std::string, std::string > &={})
virtual ProcessId createProcess (const std::string &, const std::string &, const std::string &, const std::map< std::string, std::string > &={})
virtual void execute (const std::string &, const std::string &, const std::string &, const std::string &, const std::map< std::string, std::string > &={})
virtual void execute (const std::string &, const std::string &="", const std::string &="", const std::map< std::string, std::string > &={})
virtual wstream getInputStream (const ProcessId) const
virtual rstream getOutputStream (const ProcessId) const
virtual ProcessId createProcess (ProcessManager::Command &)
virtual void wait (const ProcessId)
virtual ~ProcessManager ()

Protected Member Functions

virtual void cleanUp ()

Detailed Description

a class used to handle external processes

Constructor & Destructor Documentation

◆ ~ProcessManager()

virtual tfel::system::ProcessManager::~ProcessManager ( )
virtual

destructor. kills all registred process and close all input/output file descriptors.

Member Function Documentation

◆ createProcess() [1/3]

virtual ProcessId tfel::system::ProcessManager::createProcess ( const std::string & ,
const RedirectionType = None )
virtual

create a new process

Parameters
conststd::string&, command to be executed. The first word is the program name, the others options
constRedirectionType, tells if standard file descriptors must be redirected.
Returns
const ProcessId, the pid of the new process

◆ createProcess() [2/3]

virtual ProcessId tfel::system::ProcessManager::createProcess ( const std::string & ,
const std::string & ,
const std::string & ,
const std::map< std::string, std::string > & = {} )
virtual

create a new process

Parameters
[in]commandcommand to be executed. The first word is the program name, the others options
[in]conststd::string&, name of a file to which the new process standard input is redirected. This option is ignored if this name is void.
conststd::string&, name of a file to which the new process standard output is redirected. This option is ignored if this name is void.
[in]e: additionnal environment variables for the child process
Returns
the pid of the new process

◆ createProcess() [3/3]

virtual ProcessId tfel::system::ProcessManager::createProcess ( const std::string & ,
const std::string & ,
const std::string & ,
const std::string & ,
const std::map< std::string, std::string > & = {} )
virtual

create a new process

Parameters
[in]commandcommand to be executed. The first word is the program name, the others options
[in]conststd::string&, name of a file to which the new process standard input is redirected. This option is ignored if this name is void.
conststd::string&, name of a file to which the new process standard output is redirected. This option is ignored if this name is void.
[in]e: additionnal environment variables for the child process
Returns
the pid of the new process

◆ execute() [1/2]

virtual void tfel::system::ProcessManager::execute ( const std::string & ,
const std::string & ,
const std::string & ,
const std::string & ,
const std::map< std::string, std::string > & = {} )
virtual

execute the command and wait until its end

Parameters
conststd::string&, command to be executed. The first word is the program name, the others options
conststd::string&, name of a file to which the new process standard input is redirected. This option is ignored if this name is void.
conststd::string&, name of a file to which the new process standard output is redirected. This option is ignored if this name is void.
[in]e: additionnal environment variables for the child process

◆ execute() [2/2]

virtual void tfel::system::ProcessManager::execute ( const std::string & ,
const std::string & = "",
const std::string & = "",
const std::map< std::string, std::string > & = {} )
virtual

execute the command and wait until its end

Parameters
conststd::string&, command to be executed. The first word is the program name, the others options
conststd::string&, name of a file to which the new process standard input is redirected. This option is ignored if this name is void.
conststd::string&, name of a file to which the new process standard output is redirected. This option is ignored if this name is void.
[in]e: additionnal environment variables for the child process

◆ stopOnSignals()

void tfel::system::ProcessManager::stopOnSignals ( const bool )
Note
this method is not virtual to be callable in ProcessManager's constructor

The documentation for this struct was generated from the following file: