Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/child_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ pub struct ChildContext<C> {
}

impl<C> ChildContext<C> {
/// Construct a new [`ChildContext`].
pub fn new(child: C, command: Box<dyn CommandDisplay + Send + Sync>) -> Self {
Self { child, command }
}

/// Get the child process.
pub fn into_child(self) -> C {
self.child
Expand Down
5 changes: 1 addition & 4 deletions src/command_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,7 @@ impl CommandExt for Command {
fn spawn_checked(&mut self) -> Result<Self::Child, Self::Error> {
let displayed: Utf8ProgramAndArgs = (&*self).into();
match self.spawn() {
Ok(child) => Ok(ChildContext {
child,
command: Box::new(displayed),
}),
Ok(child) => Ok(ChildContext::new(child, Box::new(displayed))),
Err(inner) => Err(Error::from(ExecError::new(Box::new(displayed), inner))),
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/process_wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ impl CommandExt for StdCommandWrap {
fn spawn_checked(&mut self) -> Result<Self::Child, Self::Error> {
let displayed: Utf8ProgramAndArgs = self.command().into();
match self.spawn() {
Ok(child) => Ok(ChildContext {
child,
command: Box::new(displayed),
}),
Ok(child) => Ok(ChildContext::new(child, Box::new(displayed))),
Err(inner) => Err(Error::from(ExecError::new(Box::new(displayed), inner))),
}
}
Expand Down