process: Fix clippy warnings

This commit is contained in:
Ivan Petkov
2019-06-24 16:57:19 -07:00
parent caf43221b5
commit f16725ea9f
7 changed files with 60 additions and 46 deletions
+16 -10
View File
@@ -319,15 +319,21 @@ pub trait CommandExt {
fn output_async_with_handle(&mut self, handle: &Handle) -> OutputAsync;
}
struct SpawnedChild {
child: imp::Child,
stdin: Option<imp::ChildStdin>,
stdout: Option<imp::ChildStdout>,
stderr: Option<imp::ChildStderr>,
}
impl CommandExt for Command {
fn spawn_async_with_handle(&mut self, handle: &Handle) -> io::Result<Child> {
imp::Child::new(self.spawn()?, handle)
.map(|(child, stdin, stdout, stderr)| Child {
child,
stdin: stdin.map(|inner| ChildStdin { inner }),
stdout: stdout.map(|inner| ChildStdout { inner }),
stderr: stderr.map(|inner| ChildStderr { inner }),
imp::spawn_child(self, handle)
.map(|spawned_child| Child {
child: spawned_child.child,
stdin: spawned_child.stdin.map(|inner| ChildStdin { inner }),
stdout: spawned_child.stdout.map(|inner| ChildStdout { inner }),
stderr: spawned_child.stderr.map(|inner| ChildStderr { inner }),
kill_on_drop: true,
})
}
@@ -353,7 +359,7 @@ impl CommandExt for Command {
let inner = self.spawn_async_with_handle(handle)
.into_future()
.and_then(|c| c.wait_with_output());
.and_then(Child::wait_with_output);
OutputAsync {
inner: Box::new(inner),
@@ -445,9 +451,9 @@ impl Child {
WaitWithOutput {
inner: Box::new(self.join3(stdout, stderr).map(|(status, stdout, stderr)| {
Output {
status: status,
stdout: stdout,
stderr: stderr,
status,
stdout,
stderr,
}
}))
}