Small builder-style helper to assemble a Process::Config and then construct a Process.
More...
#include <dfx-subprocess/ProcessFactory.hpp>
Small builder-style helper to assemble a Process::Config and then construct a Process.
ProcessFactory owns a single mutable Process::Config instance. You configure it via the set*() fluent setters, then either:
- Warning
- This helper is effectively single-use: both build() and buildConfig() move (std::move) the internal configuration out of the factory. After calling either, the factory’s internal config is in a moved-from state and should be considered unspecified until you assign all fields again.
- Note
- This class performs no validation. For example, it does not call Process::resolveProgramPath() or check that bin exists/is executable; any such behavior is handled elsewhere.
◆ build()
Build a Process using the current configuration and bind it to a poller.
This function moves (std::move) the internal configuration into the returned Process. After this call, the factory is left with a moved-from configuration.
- Parameters
-
| poller | Poller instance used by the created process. |
- Returns
- A new Process constructed with the current configuration.
- Warning
- After calling this, the factory should not be reused unless you fully reinitialize its configuration via the setters.
◆ buildConfig()
Extract the current Process::Config.
This function moves (std::move) the internal configuration out of the factory. After this call, the factory is left with a moved-from configuration.
- Returns
- The configuration currently stored in the factory.
- Warning
- After calling this, the factory should not be reused unless you fully reinitialize its configuration via the setters.
◆ setArgs()
| ProcessFactory & dfx::Subprocess::ProcessFactory::setArgs |
( |
std::vector< std::string > | args | ) |
|
|
inlinenoexcept |
Set the argument vector.
- Parameters
-
- Returns
- *this for fluent chaining.
◆ setBin()
| ProcessFactory & dfx::Subprocess::ProcessFactory::setBin |
( |
fs::path | p | ) |
|
|
inlinenoexcept |
Set the program path/name to execute.
- Parameters
-
- Returns
- *this for fluent chaining.
◆ setCwd()
| ProcessFactory & dfx::Subprocess::ProcessFactory::setCwd |
( |
fs::path | p | ) |
|
|
inlinenoexcept |
Set the working directory.
- Parameters
-
- Returns
- *this for fluent chaining.
◆ setEnv()
| ProcessFactory & dfx::Subprocess::ProcessFactory::setEnv |
( |
std::vector< std::string > | env | ) |
|
|
inlinenoexcept |
Set the environment vector.
- Parameters
-
| env | Environment entries (typically "KEY=VALUE" strings). |
- Returns
- *this for fluent chaining.
◆ setEnvMode()
Set the environment mode.
- Parameters
-
- Returns
- *this for fluent chaining.
◆ setStderrCaptureConfig()
Set capture configuration for stderr.
- Parameters
-
| conf | Capture configuration. |
- Returns
- *this for fluent chaining.
◆ setStderrMode()
Set how stderr is connected for the child.
- Parameters
-
- Returns
- *this for fluent chaining.
◆ setStdinMode()
Set how stdin is connected for the child.
- Parameters
-
- Returns
- *this for fluent chaining.
◆ setStdoutCaptureConfig()
Set capture configuration for stdout.
- Parameters
-
| conf | Capture configuration. |
- Returns
- *this for fluent chaining.
◆ setStdoutMode()
Set how stdout is connected for the child.
- Parameters
-
- Returns
- *this for fluent chaining.
◆ setUseParentDeathSignal()
| ProcessFactory & dfx::Subprocess::ProcessFactory::setUseParentDeathSignal |
( |
bool | use | ) |
|
|
inlinenoexcept |
Enable/disable the parent-death signal behavior.
- Parameters
-
- Returns
- *this for fluent chaining.
The documentation for this class was generated from the following file: