pub struct SpawnSpec { /* private fields */ }Expand description
Typed spawn description accepted by the blessed process boundary.
Implementations§
Source§impl SpawnSpec
impl SpawnSpec
Sourcepub fn new(program: impl Into<OsString>) -> Self
pub fn new(program: impl Into<OsString>) -> Self
Create a direct (non-shell) command description.
Sourcepub fn arg(self, arg: impl Into<OsString>) -> Self
pub fn arg(self, arg: impl Into<OsString>) -> Self
Append one argument without requiring UTF-8.
Sourcepub fn current_dir(self, path: impl Into<PathBuf>) -> Self
pub fn current_dir(self, path: impl Into<PathBuf>) -> Self
Set the child working directory.
Sourcepub fn env(self, key: impl Into<OsString>, value: impl Into<OsString>) -> Self
pub fn env(self, key: impl Into<OsString>, value: impl Into<OsString>) -> Self
Add an environment override.
Sourcepub fn clear_env(self, clear: bool) -> Self
pub fn clear_env(self, clear: bool) -> Self
Start with an empty inherited environment before applying overrides.
Sourcepub fn stdin(self, mode: StreamMode) -> Self
pub fn stdin(self, mode: StreamMode) -> Self
Configure child stdin.
Sourcepub fn stdout(self, mode: StreamMode) -> Self
pub fn stdout(self, mode: StreamMode) -> Self
Configure child stdout.
Sourcepub fn stderr(self, mode: StreamMode) -> Self
pub fn stderr(self, mode: StreamMode) -> Self
Configure child stderr.
Sourcepub fn create_process_group(self, create: bool) -> Self
pub fn create_process_group(self, create: bool) -> Self
Put the child in its own process group.
This is what makes a group-wide soft signal addressable at all:
PlatformEmergencySignal::terminate_group_soft is a no-op without
it, because on POSIX the negative-PID signal would otherwise reach the
caller’s own group, and on Windows GenerateConsoleCtrlEvent only
routes to children spawned with CREATE_NEW_PROCESS_GROUP. It also
detaches the child from the parent’s console Ctrl+C, so it is opt-in.
Sourcepub fn kill_when_owner_dies(self, kill: bool) -> Self
pub fn kill_when_owner_dies(self, kill: bool) -> Self
Kill this child when the spawning process exits unexpectedly.
Linux uses PR_SET_PDEATHSIG(SIGTERM). Windows assigns the child to a
process-wide kill-on-close Job Object. macOS retains the modeled
kqueue-supervisor contract; its concrete supervisor is not part of the
async platform spawn seam yet.
Sourcepub async fn spawn(self) -> Result<PlatformChild>
pub async fn spawn(self) -> Result<PlatformChild>
Spawn using the canonical asynchronous platform operation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpawnSpec
impl RefUnwindSafe for SpawnSpec
impl Send for SpawnSpec
impl Sync for SpawnSpec
impl Unpin for SpawnSpec
impl UnsafeUnpin for SpawnSpec
impl UnwindSafe for SpawnSpec
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> 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