.. index:: pair: class; ProcessLauncher .. _doxid-class_process_launcher: template class ProcessLauncher ============================== .. toctree:: :hidden: Overview ~~~~~~~~ Base class for all process launchers. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include template < class PROCESS_LAUNCHER, const char* LAUNCHER_TYPE, class ... LAUNCHER_COMMANDS > class ProcessLauncher: public :ref:`ProcessLauncherInterface` { public: // fields static constexpr auto :target:`LauncherType` = LAUNCHER_TYPE; // methods virtual :ref:`ProcessLauncherInterface::unique_ptr` :ref:`createLauncher`(int logFD = -1); virtual std::string :ref:`launcherName`() const; virtual pid_t :ref:`launchProcess`( :ref:`nlohmann::json` procConfig, bool appendParentEnv = true ); virtual pid_t :ref:`stopProcess`(unsigned int killWait); }; // direct descendants class :ref:`ProcessLauncherBasic`; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // typedefs typedef std::shared_ptr :ref:`shared_ptr`; typedef std::shared_ptr :ref:`const_shared_ptr`; typedef std::unique_ptr :ref:`unique_ptr`; typedef std::unique_ptr :ref:`const_unique_ptr`; typedef :ref:`LaunchCommandInterface::ENGINE_RUNNING_STATUS` :ref:`ENGINE_RUNNING_STATUS`; // fields static constexpr auto :ref:`UNKNOWN` = LaunchCommandInterface::ENGINE_RUNNING_STATUS::UNKNOWN; static constexpr auto :ref:`RUNNING` = LaunchCommandInterface::ENGINE_RUNNING_STATUS::RUNNING; static constexpr auto :ref:`STOPPED` = LaunchCommandInterface::ENGINE_RUNNING_STATUS::STOPPED; // methods virtual std::string :ref:`launcherName`() const = 0; virtual :ref:`ProcessLauncherInterface::unique_ptr` :ref:`createLauncher`(int logFD = -1) = 0; virtual pid_t :ref:`launchProcess`( :ref:`nlohmann::json` procConfig, bool appendParentEnv = true ) = 0; virtual pid_t :ref:`stopProcess`(unsigned int killWait) = 0; virtual :ref:`ENGINE_RUNNING_STATUS` :ref:`getProcessStatus`(); :ref:`LaunchCommandInterface`* :ref:`launchCommand`() const; void :ref:`setFileDescriptor`(int logFD); .. _details-class_process_launcher: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Base class for all process launchers. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - PROCESS_LAUNCHER - Final class derived from :ref:`ProcessLauncher ` * - LAUNCHER_TYPE - Launcher Type as string Methods ------- .. index:: pair: function; createLauncher .. _doxid-class_process_launcher_1ace22fb54a34117a81225edd2e6699cb7: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`ProcessLauncherInterface::unique_ptr` createLauncher(int logFD = -1) Create a new process launcher. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - logFD - File descriptor to route stdout and stderror outputs in launched process .. index:: pair: function; launcherName .. _doxid-class_process_launcher_1aac9a1d7097eae647725e2ea9dedc72c9: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual std::string launcherName() const Get name of launcher. .. index:: pair: function; launchProcess .. _doxid-class_process_launcher_1a22232da024235f21345ae329523298e7: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual pid_t launchProcess( :ref:`nlohmann::json` procConfig, bool appendParentEnv = true ) Fork a new process. Will read environment variables and start params from procConfig. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - procConfig - Process Configuration. Env variables and start params take precedence over envParams and startParams * - appendParentEnv - Should parent env variables be appended to child process .. rubric:: Returns: Returns Process ID of child process on success .. index:: pair: function; stopProcess .. _doxid-class_process_launcher_1ab496d4e8a90cea048e03e6bcf5ba41d4: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual pid_t stopProcess(unsigned int killWait) Stop a running process. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - killWait - Time (in seconds) to wait for process to quit by itself before force killing it. 0 means it will wait indefinitely .. rubric:: Returns: Returns child PID on success, negative value on error