blob: 58d2c2667f605e5be11e36a7324cf3d6f9dbaf38 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
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) });
}
unsafe fn pre_exec_impl<F>(&mut self, f: F)
where
F: FnMut() -> ::std::io::Result<()> + Send + Sync + 'static,
{
self.pre_exec(f);
}
fn spawn_impl(&mut self) -> ::std::io::Result<Self::Child> {
self.spawn()
}
}
|