#include <WaitingOnSubprocessExecutor.hpp>
◆ WaitingOnSubprocessExecutor()
BOL::WaitingOnSubprocessExecutor::WaitingOnSubprocessExecutor |
( |
std::string const & |
executableStringIncludingArguments, |
|
|
bool const |
isVerbose, |
|
|
int const |
patienceMilliseconds = 10000 |
|
) |
| |
Definition at line 19 of file WaitingOnSubprocessExecutor.cpp.
27 patienceTicks( ( ( patienceMilliseconds * CLOCKS_PER_SEC ) / 1000 ) ),
static void parseByChar(std::string const &stringToParse, VectorlikeArray< std::string > &destinationArray, std::string const &divisionCharSet=whitespaceChars)
void setUpArgumentCharArray()
char const ** argumentListAsArray
VectorlikeArray< std::string > executableNameAndArguments
◆ ~WaitingOnSubprocessExecutor()
BOL::WaitingOnSubprocessExecutor::~WaitingOnSubprocessExecutor |
( |
| ) |
|
◆ forkAndExecvAndWait()
bool BOL::WaitingOnSubprocessExecutor::forkAndExecvAndWait |
( |
| ) |
|
Definition at line 42 of file WaitingOnSubprocessExecutor.cpp.
52 int processStatus( 0 );
56 bool subprocessReturned(
true );
58 int forkReturnValue( fork() );
59 if( 0 > forkReturnValue )
64 <<
"BOL::error! WaitingOnSubprocessExecutor::forkAndExecvAndWait() was"
65 <<
" unable to create the subprocess; there was an error and fork()"
66 <<
" returned " << forkReturnValue << std::endl;
69 else if( 0 == forkReturnValue )
79 for(
int argumentWritingCounter( 1 );
81 ++argumentWritingCounter )
87 <<
"\", with process id " << getpid() <<
", real user id " << getuid()
88 <<
" & effective user id " << geteuid() << std::endl;
95 else if( 0 < forkReturnValue )
99 bool subprocessFinished(
false );
103 if( waitpid( forkReturnValue,
105 WNOHANG ) == forkReturnValue )
113 subprocessFinished =
true;
122 if(
false == subprocessFinished )
130 <<
"killing forked process " << forkReturnValue
131 <<
" due to it taking over " <<
patienceTicks <<
" milliseconds"
135 kill( forkReturnValue,
142 subprocessReturned =
false;
146 returnValue = WEXITSTATUS( processStatus );
148 return subprocessReturned;
static int const sleepingMicroseconds
◆ setArguments()
void BOL::WaitingOnSubprocessExecutor::setArguments |
( |
std::string const & |
argumentsAsSingleString | ) |
|
|
inline |
◆ setExecutableName()
void BOL::WaitingOnSubprocessExecutor::setExecutableName |
( |
std::string const & |
executableName | ) |
|
|
inline |
◆ setPatienceTicks()
void BOL::WaitingOnSubprocessExecutor::setPatienceTicks |
( |
int const |
patienceTicks | ) |
|
|
inline |
◆ setUpArgumentCharArray()
void BOL::WaitingOnSubprocessExecutor::setUpArgumentCharArray |
( |
| ) |
|
|
inlineprotected |
◆ argumentListAsArray
char const** BOL::WaitingOnSubprocessExecutor::argumentListAsArray |
|
protected |
◆ executableNameAndArguments
VectorlikeArray< std::string > BOL::WaitingOnSubprocessExecutor::executableNameAndArguments |
|
protected |
◆ isVerbose
bool const BOL::WaitingOnSubprocessExecutor::isVerbose |
|
protected |
◆ killingTime
clock_t BOL::WaitingOnSubprocessExecutor::killingTime |
|
protected |
◆ patienceTicks
clock_t BOL::WaitingOnSubprocessExecutor::patienceTicks |
|
protected |
◆ processId
int BOL::WaitingOnSubprocessExecutor::processId |
|
protected |
◆ sleepingMicroseconds
int const BOL::WaitingOnSubprocessExecutor::sleepingMicroseconds |
|
staticprotected |
The documentation for this class was generated from the following files: