Skip to content

Commit c8c5d89

Browse files
authored
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
1 parent abd8efa commit c8c5d89

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

libafl/src/executors/command.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,15 @@ impl CommandConfigurator for StdCommandConfigurator {
135135
self.command.stdin(Stdio::piped()).spawn()?;
136136
let mut handle = self.command.spawn()?;
137137
let mut stdin = handle.stdin.take().unwrap();
138-
stdin.write_all(input.target_bytes().as_slice())?;
139-
stdin.flush()?;
138+
if let Err(err) = stdin.write_all(input.target_bytes().as_slice()) {
139+
if err.kind() != std::io::ErrorKind::BrokenPipe {
140+
return Err(err.into());
141+
}
142+
} else if let Err(err) = stdin.flush() {
143+
if err.kind() != std::io::ErrorKind::BrokenPipe {
144+
return Err(err.into());
145+
}
146+
}
140147
drop(stdin);
141148
Ok(handle)
142149
}

0 commit comments

Comments
 (0)