-
-
Notifications
You must be signed in to change notification settings - Fork 116
Description
Usually when a command run through bacon exits with a non-zero exit code, bacon prints Command error code: <code> in the top status bar. This does not always work.
Small reproducer (in an empty cargo project):
src/main.rs:
use std::process::ExitCode;
fn main() -> ExitCode {
println!("program ran");
ExitCode::FAILURE
}No bacon.toml/global bacon config file.
Run bacon run and keep pressing r. Eventually there will be a run where the Command error code message is not shown.
Alternatively, this small script runs bacon in a loop until the message is missing:
while true; do
(sleep 1s; killall bacon) & /usr/bin/bacon run > out 2>&1
if grep -q "program ran" out && ! grep -q "Command error code: 1" out; then
break
fi
doneFor me, it took about a minute to reproduce with this script.
For this simple program, it doesn’t happen very often (maybe 1% of the time), but in a real project (which prints about 120 lines and overall takes about 200ms to run), this happens at a noticeable rate, maybe 50%.
Slightly larger reproducer that makes manual reproduction easier:
use std::process::ExitCode;
use std::time::Duration;
fn main() -> ExitCode {
for i in 0..1000 {
println!("{}", i.to_string().repeat(i));
}
std::thread::sleep(Duration::from_millis(150));
println!("program ran");
ExitCode::FAILURE
}More output and longer execution times seem to make it happen more often.
As a small check that it’s not cargo that’s swallowing the exit code, this does not terminate for me:
while ! cargo run; do true; done