This commit is contained in:
Jason Gedge 2020-01-13 01:38:58 -05:00 committed by Jonathan Turner
parent 29fd8b55fb
commit 65980c7beb

View File

@ -296,23 +296,26 @@ async fn run_with_stdin(
} }
} }
let errored = match popen.wait() { loop {
Ok(status) => !status.success(), match popen.poll() {
Err(e) => true, None => std::thread::sleep(std::time::Duration::new(0, 100_000_000)),
}; Some(status) => {
if !status.success() {
if errored { yield Ok(Value {
yield Ok(Value { value: UntaggedValue::Error(
value: UntaggedValue::Error( ShellError::labeled_error(
ShellError::labeled_error( "External command failed",
"External command failed", "command failed",
"command failed", &name_tag,
&name_tag, )
) ),
), tag: name_tag,
tag: name_tag, });
}); }
}; break;
}
}
}
}; };
Ok(Some(stream.to_input_stream())) Ok(Some(stream.to_input_stream()))