Use ${PIPESTATUS[0]} to catch the error code of worker.sh
This commit is contained in:
1 parent
a2ec519570
commit
4e7969814f
1 file changed
+1
-1
@@ -76,7 +76,7 @@ jobs:
|
||||
for FILE in $FILES; do
|
||||
echo "$FILE"
|
||||
bash -e code/worker.sh $(readlink -f "$FILE") 2>&1 | tee log.txt
|
||||
EXIT_CODE=$?
|
||||
EXIT_CODE=${PIPESTATUS[0]} # bashism; get the return code of the leftmost element of the pipe
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
echo "worker.sh exited with a non-zero code: $EXIT_CODE"
|
||||
exit $EXIT_CODE
|
||||
|
||||
Reference in new issue
Block a user