12#include <boost/noncopyable.hpp>
16#include <boost/shared_ptr.hpp>
18#include <unordered_set>
32class ProcessSpawnImpl;
81 const std::string& executable,
84 const bool inherit_env =
false);
92 std::string
getCommandLine(std::unordered_set<std::string> redact_args = {})
const;
107 pid_t
spawn(
bool dismiss =
false);
157 return (io_service_);
164 io_service_ = io_service;
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
ProcessSpawnError(const char *file, size_t line, const char *what)
bool isAnyRunning() const
Checks if any of the spawned processes is still running.
int getExitStatus(const pid_t pid) const
Returns exit status of the process.
void clearState(const pid_t pid)
Removes the status of the process with a specified PID.
std::string getCommandLine(std::unordered_set< std::string > redact_args={}) const
Returns full command line, including arguments, for the process.
ProcessSpawn(const SpawnMode mode, const std::string &executable, const ProcessArgs &args=ProcessArgs(), const ProcessEnvVars &vars=ProcessEnvVars(), const bool inherit_env=false)
Constructor.
bool isRunning(const pid_t pid) const
Checks if the process is still running.
~ProcessSpawn()=default
Destructor.
pid_t spawn(bool dismiss=false)
Spawn the new process.
static isc::asiolink::IOServicePtr getIOService()
Get the I/O service.
static void setIOService(isc::asiolink::IOServicePtr io_service)
Set the I/O service.
std::vector< std::string > ProcessArgs
Type of the container holding arguments of the executable being run as a background process.
std::vector< std::string > ProcessEnvVars
Type of the container holding environment variables of the executable being run as a background proce...
boost::shared_ptr< ProcessSpawnImpl > ProcessSpawnImplPtr
Pointer to a ProcessSpawnImpl class.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Defines the logger used by the top-level component of kea-lfc.