Skip to main content

SpawnOpts

Struct SpawnOpts 

Source
pub struct SpawnOpts {
Show 15 fields pub cwd: PathBuf, pub env: Vec<(String, String)>, pub label: Option<String>, pub initiator: Initiator, pub pty_cols: u16, pub pty_rows: u16, pub stdin_enabled: bool, pub pin: bool, pub beholder_select: BeholderSelect, pub verbatim_output: bool, pub log_fd_enabled: bool, pub origin: Option<String>, pub argv: Option<Vec<String>>, pub pipe: bool, pub pipefail: bool,
}
Expand description

Options for TaskDriver::spawn_run.

Fields§

§cwd: PathBuf§env: Vec<(String, String)>

Env vars set on the child process (merged on top of the current env).

§label: Option<String>§initiator: Initiator§pty_cols: u16

PTY column count. Defaults to 80.

§pty_rows: u16

PTY row count. Defaults to 24.

§stdin_enabled: bool

Enable stdin relay via TaskDriver::send_stdin.

§pin: bool

Pin the run so the GC sweep does not drop its output during warm rolloff.

§beholder_select: BeholderSelect

Beholder attachment policy. Defaults to BeholderSelect::Auto.

§verbatim_output: bool

true when this run’s output is read as text by somebody downstream — a human watching a terminal tile, or a client that promised its caller byte-identical passthrough. Causes Rewriter beholders to decline in Auto mode, since a rewrite changes what that reader gets.

R739-B10 renamed this from tty_attached: a PTY was only ever a proxy for “someone is reading this”, and the proxy broke the moment yah build run moved onto pipes (R739-F6).

§log_fd_enabled: bool

Create a side-channel FIFO and export YAH_TASK_RUN / YAH_LOG_PIPE so Tier-2 shim libraries (yah-log-rust, @yah/log) can emit structured events. Has no effect on non-Unix platforms. Defaults to true.

§origin: Option<String>

Provenance tag stored on the run’s TaskRunMeta.origin (e.g. Some("terminal") for an interactive shell). None is an ordinary job.

§argv: Option<Vec<String>>

Exec this argv directly instead of wrapping cmd in sh -c.

The default sh -c <cmd> is right for a job — the caller wrote a command line and expects a shell to parse it. It is wrong for an interactive shell: sh -c "zsh -l" leaves an inert sh as the PTY’s foreground process group leader, so job control misbehaves, signals go to the wrong process, and anything that reads the foreground pid (a live-cwd probe, say) sees sh instead of the shell the operator is typing into. Handing the exact argv here makes the shell itself the child, which is also the only way to pass -l as a real argv element so .zprofile / .profile actually run.

cmd is still what gets recorded on TaskRunMeta.command, so the run reads the way the caller asked for it. Beholder argv rewriting is bypassed when this is set: the caller has already decided the exact process to exec, and a recorded rewrite=… that didn’t happen would be a lie in the run metadata.

§pipe: bool

R739-F6 — spawn on pipes instead of a PTY. Defaults to false, which is the PTY behaviour every existing caller already has.

A PTY is right for an interactive terminal tile: the child gets a controlling terminal, job control works, and isatty says yes, which is what a human sitting in front of it expects. It is wrong for emulating a non-interactive shell invocation, where three PTY properties show up as divergence from running the same command directly (all three measured in R739-F4 against cargo check):

  1. isatty(1) is true, so tools colorize — plain error: … arrives as \x1b[1m\x1b[91merror\x1b[0m: …, which also defeats | rg "^error".
  2. The line discipline’s ONLCR rewrites every \n the child wrote into \r\n.
  3. The terminal merges stderr into stdout, so stream separation is gone by the time anything reads the capture.

In pipe mode the child gets pipe(2) for stdout and stderr, chunks are stored under their true Stream, and TERM is left alone rather than forced to xterm-256color. TaskDriver::resize_run and TaskDriver::foreground_pid have no PTY to answer for and report NotFound / None.

§pipefail: bool

R901-B2 — run the sh -c line with pipefail, so a pipeline reports the leftmost failing stage instead of its last one. Defaults to false, i.e. POSIX behaviour, which is what every existing caller has.

Without it a pipeline’s status is the last stage’s and nothing else: cargo check 2>&1 | tail -40 exits 0 on a build with 101 errors, because tail succeeded. That is not a wrapper lying — the wrapper is faithful, and the shell is answering the question it was actually asked — but it is indistinguishable from a green build to everything downstream, including the harness task notification an agent reads to decide whether it is done. On 2026-09-13 two sessions read that 0 as a pass and left cargo check -p yah red camp-wide for ~50 minutes.

Only meaningful when SpawnOpts::argv is None; an explicit argv is not a shell line and has no pipeline to take a status from.

§Known cost, accepted deliberately

pipefail also surfaces a producer killed by SIGPIPE, so cargo check 2>&1 | head -40 can now report failure once head closes the pipe early on a build that was fine. That is a false RED, and it is the right trade against the false GREEN above: a red is investigated, a green ends the turn. Prefer | tail over | head on a build line.

Trait Implementations§

Source§

impl Clone for SpawnOpts

Source§

fn clone(&self) -> SpawnOpts

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpawnOpts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SpawnOpts

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &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)

Converts &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> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Fruit for T
where T: Send + Downcast,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more