Implement blocking output
This allows decoupling `Command::spawn` and `Command::output`. This is useful for targets which do support launching programs in blocking mode but do not support multitasking (Eg: UEFI). This was originally conceived when working on https://github.com/rust-lang/rust/pull/100316 Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
This commit is contained in:
parent
5479fe5f70
commit
a94793d8d1
9 changed files with 61 additions and 6 deletions
|
@ -911,10 +911,8 @@ impl Command {
|
|||
/// ```
|
||||
#[stable(feature = "process", since = "1.0.0")]
|
||||
pub fn output(&mut self) -> io::Result<Output> {
|
||||
self.inner
|
||||
.spawn(imp::Stdio::MakePipe, false)
|
||||
.map(Child::from_inner)
|
||||
.and_then(|p| p.wait_with_output())
|
||||
let (status, stdout, stderr) = self.inner.output()?;
|
||||
Ok(Output { status: ExitStatus(status), stdout, stderr })
|
||||
}
|
||||
|
||||
/// Executes a command as a child process, waiting for it to finish and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue