Skip to content

Commit

Permalink
Handle errors nicely even if output is stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerb9 committed Jul 30, 2024
1 parent b7b9f7f commit 7fd1955
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tokenize
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,14 @@ function main() {
m100-sanity "$f" | m100-tokenize > "$g" || fail=1
fi

echo fail is $fail
if [[ $fail -gt 0 ]]; then
echo "Error detected, removing '$g'" >&2
rm "$g"
echo -n "Error detected"
if [[ $g != "-" ]]; then
echo ", removing '$g'" >&2
rm "$g"
else
echo
fi
exit 1
fi
}
Expand Down

0 comments on commit 7fd1955

Please sign in to comment.