Skip to content

Commit 39ffb8d

Browse files
committed
why does exec work but output=$(...) doesn't?
1 parent 2ac5438 commit 39ffb8d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/SPC/store/scripts/zig-cc.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ done
3131
output=$(zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}" 2>&1)
3232
status=$?
3333

34-
if [[ $status -ne 0 ]] && grep -q "version '.*' in target triple" <<< "$output"; then
35-
output=$(grep -v "version '.*' in target triple" <<< "$output")
36-
status=0
37-
fi
34+
if [[ $status -eq 0 ]]; then
35+
echo "$output"
36+
exit 0
37+
else
38+
if grep -q "version '.*' in target triple" <<< "$output"; then
39+
output=$(grep -v "version '.*' in target triple" <<< "$output")
40+
status=0
41+
fi
3842

39-
echo "$output"
40-
exit $status
43+
exec zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}"
44+
fi

0 commit comments

Comments
 (0)