Ignore 'Broken Pipe' if child process does not read all of stdin (#1244)
* Ignore 'Broken Pipe' if child process does not read all of stdin * follow clippy suggestion
This commit is contained in:
parent
abd8efabd3
commit
c8c5d89f33
@ -135,8 +135,15 @@ impl CommandConfigurator for StdCommandConfigurator {
|
|||||||
self.command.stdin(Stdio::piped()).spawn()?;
|
self.command.stdin(Stdio::piped()).spawn()?;
|
||||||
let mut handle = self.command.spawn()?;
|
let mut handle = self.command.spawn()?;
|
||||||
let mut stdin = handle.stdin.take().unwrap();
|
let mut stdin = handle.stdin.take().unwrap();
|
||||||
stdin.write_all(input.target_bytes().as_slice())?;
|
if let Err(err) = stdin.write_all(input.target_bytes().as_slice()) {
|
||||||
stdin.flush()?;
|
if err.kind() != std::io::ErrorKind::BrokenPipe {
|
||||||
|
return Err(err.into());
|
||||||
|
}
|
||||||
|
} else if let Err(err) = stdin.flush() {
|
||||||
|
if err.kind() != std::io::ErrorKind::BrokenPipe {
|
||||||
|
return Err(err.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
drop(stdin);
|
drop(stdin);
|
||||||
Ok(handle)
|
Ok(handle)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user