show command stderr of failure #29
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
poopto 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.Pollerreads, it only really makes sense to use a power of two sized buffer - I chose 4096 for no particular reason. The waystd.io.Pollerreads means that even if there is more than 4096 bytes of stderr, any where between4096-512+1=3585and4096bytes 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