Skip to content

Commit 1a98e43

Browse files
authored
fix: eliminate broken pipe warnings in benchmark harness (#1148)
## Why The first CI run of the benchmark harness ([run 23769619685](https://github.com/ambient-code/platform/actions/runs/23769619685)) produced repeated `echo: write error: Broken pipe` warnings on stderr. While harmless, they clutter CI logs and could mask real errors. ## Summary - `bench_has_scenario` used process substitution (`< <(bench_scenarios_for_mode)`) with an early `return 0` on match. When mode is `both`, the function emits two lines (`cold`, `warm`). If the first line matches, the reader closes the pipe before the second `echo` completes, triggering SIGPIPE. - Fix: capture the output in a variable first (`scenarios=$(bench_scenarios_for_mode)`), then iterate via here-string (`<<< "$scenarios"`). Both `echo` calls complete before iteration begins. ## Test plan - [x] `shellcheck` clean (same pre-existing false positives only) - [x] `bash tests/bench-test.sh` passes 8/8 - [ ] CI run produces no broken pipe warnings Made with [Cursor](https://cursor.com) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes This release includes internal refactoring improvements to development tooling and does not contain any changes visible to end-users. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Robert Gregor <348865+bobbravo2@users.noreply.github.com>
1 parent 26687af commit 1a98e43

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/benchmarks/component-bench.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,15 @@ bench_scenarios_for_mode() {
434434

435435
bench_has_scenario() {
436436
local wanted=$1
437+
local scenarios
438+
scenarios=$(bench_scenarios_for_mode)
437439
local scenario
438440

439441
while IFS= read -r scenario; do
440442
if [[ "$scenario" == "$wanted" ]]; then
441443
return 0
442444
fi
443-
done < <(bench_scenarios_for_mode)
445+
done <<< "$scenarios"
444446

445447
return 1
446448
}

0 commit comments

Comments
 (0)