diff options
| author | Ayush Singh <ayushsingh1325@gmail.com> | 2022-12-08 18:22:33 +0530 |
|---|---|---|
| committer | Ayush Singh <ayushsingh1325@gmail.com> | 2022-12-11 10:21:40 +0530 |
| commit | a94793d8d17e4cfe2e727c30c36e174b8d6b6ee3 (patch) | |
| tree | 4a6bb73b64331a1ab40165c5c8892bedb1ec837e /library/std/src/sys/unix/process/process_fuchsia.rs | |
| parent | 5479fe5f70bb32f037ff97de03ed185bdf2f54b7 (diff) | |
| download | rust-a94793d8d17e4cfe2e727c30c36e174b8d6b6ee3.tar.gz rust-a94793d8d17e4cfe2e727c30c36e174b8d6b6ee3.zip | |
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>
Diffstat (limited to 'library/std/src/sys/unix/process/process_fuchsia.rs')
| -rw-r--r-- | library/std/src/sys/unix/process/process_fuchsia.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/process/process_fuchsia.rs b/library/std/src/sys/unix/process/process_fuchsia.rs index 66ea3db2015..4c99d758c93 100644 --- a/library/std/src/sys/unix/process/process_fuchsia.rs +++ b/library/std/src/sys/unix/process/process_fuchsia.rs @@ -35,6 +35,11 @@ impl Command { Ok((Process { handle: Handle::new(process_handle) }, ours)) } + pub fn output(&mut self) -> io::Result<(ExitStatus, Vec<u8>, Vec<u8>)> { + let (proc, pipes) = self.spawn(Stdio::MakePipe, false)?; + crate::sys_common::process::wait_with_output(proc, pipes) + } + pub fn exec(&mut self, default: Stdio) -> io::Error { if self.saw_nul() { return io::const_io_error!( |
