pub struct SpawnCommandRequest {
pub command: String,
pub cwd: Option<PathBuf>,
pub env: Vec<(String, String)>,
pub originator: Option<String>,
pub clear_inherited_env: bool,
}Expand description
Request to spawn a detached daemonized shell command under daemon control.
Fields§
§command: String§cwd: Option<PathBuf>§env: Vec<(String, String)>§originator: Option<String>§clear_inherited_env: boolWhen true, the daemon clears the inherited env before applying
Self::env, so the subprocess sees ONLY the supplied map.
Mirrors Python’s subprocess.Popen(env=…) replace semantic.
Default false keeps the historic “layer on top of inherited”
behaviour.
Implementations§
Source§impl SpawnCommandRequest
impl SpawnCommandRequest
Sourcepub fn shell(command: impl Into<String>) -> Self
pub fn shell(command: impl Into<String>) -> Self
Build a shell-command request using the caller’s current working directory and environment.
Sourcepub fn with_cwd(self, cwd: impl Into<PathBuf>) -> Self
pub fn with_cwd(self, cwd: impl Into<PathBuf>) -> Self
Override the working directory used for the spawned command.
Sourcepub fn with_envs<I, K, V>(self, env: I) -> Self
pub fn with_envs<I, K, V>(self, env: I) -> Self
Replace the environment block sent to the daemon (layered on top
of the daemon’s inherited env, unless Self::with_env_replace
is used instead).
Sourcepub fn with_env_replace<I, K, V>(self, env: I) -> Self
pub fn with_env_replace<I, K, V>(self, env: I) -> Self
Set the env block AND tell the daemon to clear the inherited env first — the subprocess will see ONLY the supplied map.
Mirrors Python’s subprocess.Popen(env=…) semantic:
subprocess.Popen(["..."], env=None) # inherits
subprocess.Popen(["..."], env={"K": "V"}) # replacesOn Windows you typically still want to include SystemRoot in
the supplied map so cmd.exe can load its DLLs.
Sourcepub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add or replace a single environment variable while keeping the rest of the existing environment block intact.
Sourcepub fn with_originator(self, originator: impl Into<String>) -> Self
pub fn with_originator(self, originator: impl Into<String>) -> Self
Set the originator value stored in the daemon registry and injected into the spawned child environment.
Trait Implementations§
Source§impl Clone for SpawnCommandRequest
impl Clone for SpawnCommandRequest
Source§fn clone(&self) -> SpawnCommandRequest
fn clone(&self) -> SpawnCommandRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more