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: StringShell command line to execute.
cwd: Option<PathBuf>Working directory for the spawned command.
env: Vec<(String, String)>Environment key/value pairs sent with the request.
originator: Option<String>Caller-provided originator used for tracking and filtering.
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 moreAuto Trait Implementations§
impl Freeze for SpawnCommandRequest
impl RefUnwindSafe for SpawnCommandRequest
impl Send for SpawnCommandRequest
impl Sync for SpawnCommandRequest
impl Unpin for SpawnCommandRequest
impl UnsafeUnpin for SpawnCommandRequest
impl UnwindSafe for SpawnCommandRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more