I don't think it makes that much sense for poop to capture arbitrarily large amounts of stderr, so I think it makes sense to just truncate after a certain amount is captured. Due to the way std.io.Poller reads, it only really makes sense to use a power of two sized buffer - I chose 4096 for no particular reason. The waystd.io.Poller reads means that even if there is more than 4096 bytes of stderr, any where between 4096-512+1=3585 and 4096 bytes might be read as the poller always tries to read at least 512 bytes.
If the stderr is truncated the stderr will look like this:
────────────── stderr truncated ──────────────
ls: cannot access 'a': N
──────────────────────────────────────────────
Closes #9. Here is the output for a command failing.
I ~/S/poop (child-stderr +) [1] > zig-out/bin/poop ls 'ls a' ls -d 50 Benchmark 1 (24 runs): ls measurement mean ± σ min … max outliers delta wall_time 1.432ms ± 484.231us 773.111us … 1.972ms 0 ( 0%) 0% peak_rss 2M ± 70K 2M … 2M 0 ( 0%) 0% cpu_cycles 387633 ± 64478 354835 … 608024 3 (13%) 0% instructions 398961 ± 75 398903 … 399132 0 ( 0%) 0% cache_references 28741 ± 509 27592 … 30467 2 ( 8%) 0% cache_misses 9038 ± 255 8693 … 9953 1 ( 4%) 0% branch_misses 4892 ± 124 4712 … 5187 0 ( 0%) 0% error: Benchmark 2 command 'ls a' failed with exit code 2: ─────────────────── stderr ─────────────────── ls: cannot access 'a': No such file or directory ──────────────────────────────────────────────
Any benchmarks after the failed one are skipped.
I don't think it makes that much sense for
poop
to capture arbitrarily large amounts of stderr, so I think it makes sense to just truncate after a certain amount is captured. Due to the waystd.io.Poller
reads, it only really makes sense to use a power of two sized buffer - I chose 4096 for no particular reason. The waystd.io.Poller
reads means that even if there is more than 4096 bytes of stderr, any where between4096-512+1=3585
and4096
bytes might be read as the poller always tries to read at least 512 bytes.If the stderr is truncated the stderr will look like this:
But with presumably much more output