Canop / Canop/bacon

`stdout` and `stderr` are sometimes interleaved

Open
#363 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.4k
Forks
126
Avg merge
2d 1h
Merged PRs (30d)
7

Description

When a `command` produces output on both `stdout` and `stderr`, sometimes both are interleaved.

Small reproducer (with `cargo new t && cd t`):
`src/main.rs`:
```rust
fn main() {
for i in 0..10 {
println!("stdout: {i}");
}
for i in 0..10 {
eprintln!("stderr: {i}");
}
}
```

`bacon run`:
```
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/t`
stdout: 0
stderr: 0
stdout: 1
stdout: 2
stdout: 3
stdout: 4
stdout: 5
stdout: 6
stdout: 7
stdout: 8
stdout: 9
stderr: 1
stderr: 2
stderr: 3
stderr: 4
stderr: 5
stderr: 6
stderr: 7
stderr: 8
stderr: 9
```

(This sometimes needs a few tries.)

This is especially noticeable when the program normally produces output on `stdout` and then `dbg!()` is used to produce additional debug output.

---

```console
$ bacon --version
bacon 3.14.0
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the ordering issue with the provided src/main.rs program and bacon run, trying several runs as described. Then locate bacon's command-output handling and trace how stdout and stderr are collected or displayed. Done means output from both streams consistently preserves the command's order without interleaving.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.