diff options
Diffstat (limited to 'src/command/std.rs')
-rw-r--r-- | src/command/std.rs | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/command/std.rs b/src/command/std.rs index 5c08808..2a89db5 100644 --- a/src/command/std.rs +++ b/src/command/std.rs @@ -1,23 +1,22 @@ -use std::os::unix::io::FromRawFd as _; use std::os::unix::process::CommandExt as _; impl super::Impl for std::process::Command { type Child = std::process::Child; - type Pty = crate::pty::std::Pty; - fn std_fds( - &mut self, - stdin: ::std::os::unix::io::RawFd, - stdout: ::std::os::unix::io::RawFd, - stderr: ::std::os::unix::io::RawFd, - ) { - // safe because the fds are valid (otherwise pty.pts() or dup() would - // have returned an Err and we would have exited early) and are not - // owned by any other structure (since dup() returns a fresh copy of - // the file descriptor), allowing from_raw_fd to take ownership of it. - self.stdin(unsafe { std::process::Stdio::from_raw_fd(stdin) }) - .stdout(unsafe { std::process::Stdio::from_raw_fd(stdout) }) - .stderr(unsafe { std::process::Stdio::from_raw_fd(stderr) }); + fn new_impl(program: &::std::ffi::OsStr) -> Self { + Self::new(program) + } + + fn stdin_impl(&mut self, cfg: ::std::process::Stdio) { + self.stdin(cfg); + } + + fn stdout_impl(&mut self, cfg: ::std::process::Stdio) { + self.stdout(cfg); + } + + fn stderr_impl(&mut self, cfg: ::std::process::Stdio) { + self.stderr(cfg); } unsafe fn pre_exec_impl<F>(&mut self, f: F) @@ -27,7 +26,7 @@ impl super::Impl for std::process::Command { self.pre_exec(f); } - fn spawn_impl(&mut self) -> ::std::io::Result<Self::Child> { - self.spawn() + fn spawn_impl(&mut self) -> crate::Result<Self::Child> { + self.spawn().map_err(crate::error::spawn) } } |