Skip to content

Commit a257044

Browse files
authored
fix(ci): keep sfw diff stderr out of the parsed JSON
The diff loop captured sfw's stderr (the runsc-fallback warning) via 2>&1, corrupting the JSON jq parses. Capture stdout only.
1 parent e9192a5 commit a257044

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/semantic_analysis.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,23 @@ jobs:
167167
continue
168168
fi
169169
170-
# Execute SFW diff (sfw handles its own sandboxing internally)
171-
if ! OUTPUT=$(./bin/sfw diff "$OLD_FILE" "$NEW_FILE" 2>&1); then
170+
# Execute SFW diff (sfw handles its own sandboxing internally).
171+
# Capture STDOUT (the JSON report) only -- sfw writes warnings/errors
172+
# to stderr (e.g. the "runsc not found, falling back" notice), and
173+
# merging them with 2>&1 corrupts the JSON parsed below.
174+
if ! OUTPUT=$(./bin/sfw diff "$OLD_FILE" "$NEW_FILE" 2>sfw_stderr.log); then
172175
echo "::error::sfw failed to process $NEW_FILE_REF"
173176
# Surface the tool's actual error instead of swallowing it.
174-
printf '%s\n' "$OUTPUT" | sed 's/^/ [sfw] /'
177+
sed 's/^/ [sfw] /' sfw_stderr.log
175178
ERROR_COUNT=$((ERROR_COUNT + 1))
176179
continue
177180
fi
178181
179182
# Validate JSON
180183
if ! echo "$OUTPUT" | jq -e . >/dev/null 2>&1; then
181184
echo "::error::Invalid JSON output for $NEW_FILE_REF"
182-
printf '%s\n' "$OUTPUT" | sed 's/^/ [sfw] /'
185+
printf '%s\n' "$OUTPUT" | sed 's/^/ [out] /'
186+
sed 's/^/ [sfw] /' sfw_stderr.log
183187
ERROR_COUNT=$((ERROR_COUNT + 1))
184188
continue
185189
fi

0 commit comments

Comments
 (0)