Commit 7b2cb888 authored by Ben Boeckel's avatar Ben Boeckel

formatting: capture stderr for the error path with a timeout

parent 99bef2c9
......@@ -127,18 +127,24 @@ impl Formatting {
let (success, output) = if let Some(timeout) = self.timeout {
let mut child = cmd
// Formatters should not read anything.
// The output goes nowhere.
// But we want any error messages from them (for logging purposes). If this pipe
// fills up buffers, it will deadlock and the timeout will "save" us. Any process
// outputting this much error messages probably is very unhappy anyways.
.chain_err(|| "failed to construct formatter command")?;
let check = child.wait_timeout(timeout)
.chain_err(|| "failed to wait on the formatter command")?;
if let Some(status) = check {
(status.success(), format!("failed with exit code {:?}, signal {:?}",
(status.success(), format!("failed with exit code {:?}, signal {:?}, output: {:?}",
child.stderr.expect("spawned with stderr")))
} else {
child.kill().chain_err(|| "failed to kill a timed-out formatter")?;
let timed_out_status = child.wait_timeout(*ZOMBIE_TIMEOUT)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment