Skip to main content

LaunchSpec

Struct LaunchSpec 

Source
pub struct LaunchSpec { /* private fields */ }
Expand description

Everything needed to start a child process.

Secret values are held as SecretString right up to the moment they are handed to the process API, so no intermediate copy is formattable and the derived Debug prints the redaction rather than the value.

Implementations§

Source§

impl LaunchSpec

Source

pub fn new(argv: Vec<OsString>) -> Result<Self, LaunchError>

Builds a spec from a captured argv.

§Errors

Returns LaunchError::NoProgram if argv is empty.

Source

pub fn with_secrets( self, guard: EnvGuard, secrets: impl IntoIterator<Item = (String, SecretString)>, ) -> Result<Self, LaunchError>

Adds secrets to the child’s environment, applying the guard first.

Every name is validated with prick_core::keyname::validate and then checked against guard. The whole launch fails on the first refusal rather than dropping the offending variable: a child started with a silently missing variable is a debugging problem, and a child started with a silently present one is a breach.

§Errors

Returns LaunchError::InvalidKey for a name that is not usable as an environment variable, and LaunchError::Guard for one the dynamic loader or a language runtime interprets.

Source

pub fn program(&self) -> &OsStr

The program to run, as the user wrote it.

Source

pub fn args(&self) -> &[OsString]

The program’s arguments, excluding the program itself.

Source

pub fn env_names(&self) -> impl Iterator<Item = &str>

The names of the variables that will be added to the environment.

Names are plaintext by design and safe to show; values are not exposed.

Trait Implementations§

Source§

impl Debug for LaunchSpec

Source§

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

Formats the value using the given formatter. 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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.