.. index:: pair: class; ProcessLauncherInterface .. _doxid-class_process_launcher_interface: class ProcessLauncherInterface ============================== .. toctree:: :hidden: Overview ~~~~~~~~ Functions for all process launchers. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class ProcessLauncherInterface: public :ref:`PtrTemplates` { public: // typedefs typedef :ref:`LaunchCommandInterface::ENGINE_RUNNING_STATUS` :target:`ENGINE_RUNNING_STATUS`; // fields static constexpr auto :target:`UNKNOWN` = LaunchCommandInterface::ENGINE_RUNNING_STATUS::UNKNOWN; static constexpr auto :target:`RUNNING` = LaunchCommandInterface::ENGINE_RUNNING_STATUS::RUNNING; static constexpr auto :target:`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); }; // direct descendants template < class PROCESS_LAUNCHER, const char* LAUNCHER_TYPE, class ... LAUNCHER_COMMANDS > class :ref:`ProcessLauncher`; 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`; .. _details-class_process_launcher_interface: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Functions for all process launchers. Methods ------- .. index:: pair: function; launcherName .. _doxid-class_process_launcher_interface_1a525cd3685e3eff9a4d1ef17bf4ba06ab: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual std::string launcherName() const = 0 Get name of launcher. .. index:: pair: function; createLauncher .. _doxid-class_process_launcher_interface_1a87f91cf3ab18586e9836f3c9215df6fd: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`ProcessLauncherInterface::unique_ptr` createLauncher(int logFD = -1) = 0 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; launchProcess .. _doxid-class_process_launcher_interface_1af7dddf137ef184baf929d0d96f23de06: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual pid_t launchProcess( :ref:`nlohmann::json` procConfig, bool appendParentEnv = true ) = 0 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_interface_1aaa751375567c0aae9f7a94604e03f2cf: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual pid_t stopProcess(unsigned int killWait) = 0 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 .. index:: pair: function; getProcessStatus .. _doxid-class_process_launcher_interface_1afecd8b121e9b5df59a47584a93809b94: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`ENGINE_RUNNING_STATUS` getProcessStatus() Get the current process status. If status cannot be retrieved, return ENGINE_RUNNING_STATUS::UNKNOWN. .. rubric:: Returns: Returns status as enum :ref:`ProcessLauncherInterface::ENGINE_RUNNING_STATUS ` .. index:: pair: function; launchCommand .. _doxid-class_process_launcher_interface_1adde0e1c47dd675a2bf4e0d64cd8fea8f: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`LaunchCommandInterface`* launchCommand() const Get Launch Command. If launchProcess has not yet been called, return nullptr. .. index:: pair: function; setFileDescriptor .. _doxid-class_process_launcher_interface_1a64934c530d30a87b389f93402a36f80e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setFileDescriptor(int logFD) Sets the file descriptor that will be used by the launched process to write stdout and stderror. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - logFD - File descriptor to route stdout and stderror outputs in launched process