From 233002062acabe7b43376647f97e9f146df09865 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Mon, 12 Oct 2026 15:23:18 +0200 Subject: [PATCH] bundled-tools-can-execute: avoid 'echo | grep -q' SIGPIPE with pipefail. This fixes bundled-tools-can-execute failing when first-run welcome banner makes the output large enough to close the pipe before all output was read. We use a here-string instead to avoid the pipe entirely. This also updates use-current-runtime to use the same pattern. --- bundled-tools-can-execute/test.sh | 2 +- use-current-runtime/test.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bundled-tools-can-execute/test.sh b/bundled-tools-can-execute/test.sh index aa08ab04..449ed02d 100755 --- a/bundled-tools-can-execute/test.sh +++ b/bundled-tools-can-execute/test.sh @@ -23,7 +23,7 @@ for tool in "${!tools[@]}"; do # Ignore the exit code because 'dotnet user-secrets' has a non-zero exit for '--help'. output=$(dotnet "${tool}" --help 2>&1) || true - if echo "${output}" | grep -q "${expected}"; then + if grep -q "${expected}" <<< "${output}"; then echo "PASS: dotnet ${tool} --help" else echo "FAIL: dotnet ${tool} --help did not contain '${expected}'" diff --git a/use-current-runtime/test.sh b/use-current-runtime/test.sh index 86907c7b..a6383ab6 100755 --- a/use-current-runtime/test.sh +++ b/use-current-runtime/test.sh @@ -8,9 +8,7 @@ PORTABLE_RID="$(../runtime-id --portable)" DOTNET_BUILD_OUTPUT=$(dotnet build --use-current-runtime) -# grep -q can exit early, making the other proceses in the pipe report a -# SIGPIPE, so consume the rest of the output with cat to avoid the SIGPIPE -if echo "$DOTNET_BUILD_OUTPUT" | { grep -q "RuntimeIdentifier is $PORTABLE_RID"; cat >/dev/null; } then +if grep -q "RuntimeIdentifier is $PORTABLE_RID" <<< "$DOTNET_BUILD_OUTPUT"; then echo "PASS: --use-current-runtime uses portable rid." else echo "FAIL: --use-current-runtime does not use portable rid."