aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/async_process.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/async_process.rs')
-rw-r--r--src/command/async_process.rs33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/command/async_process.rs b/src/command/async_process.rs
index 4a1d042..a0aaa47 100644
--- a/src/command/async_process.rs
+++ b/src/command/async_process.rs
@@ -1,23 +1,22 @@
use async_process::unix::CommandExt as _;
-use std::os::unix::io::FromRawFd as _;
impl super::Impl for async_process::Command {
type Child = async_process::Child;
- type Pty = crate::pty::async_io::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 async_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)
}
}