aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/tokio.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-28 03:33:52 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-28 05:28:28 -0500
commitf8780ca1e76286688b74d8a6c64d5fadf3cfd2a1 (patch)
treeb1e0fe6a378f3a8810e0332ca572a86185fd556c /src/command/tokio.rs
parentb181b63a69d5db78769c1c3723a9940f66491466 (diff)
downloadpty-process-f8780ca1e76286688b74d8a6c64d5fadf3cfd2a1.tar.gz
pty-process-f8780ca1e76286688b74d8a6c64d5fadf3cfd2a1.zip
wip
Diffstat (limited to 'src/command/tokio.rs')
-rw-r--r--src/command/tokio.rs34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/command/tokio.rs b/src/command/tokio.rs
index 58d2c26..c63b18a 100644
--- a/src/command/tokio.rs
+++ b/src/command/tokio.rs
@@ -1,22 +1,20 @@
-use std::os::unix::io::FromRawFd as _;
-
impl super::Impl for tokio::process::Command {
type Child = tokio::process::Child;
- type Pty = crate::pty::tokio::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)
@@ -26,7 +24,7 @@ impl super::Impl for tokio::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)
}
}