From a93dc0884837d8be99f7a11530babd8b42778ddf Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Tue, 3 Aug 2021 12:07:43 +0100 Subject: [PATCH 1/2] remove set -e --- scripts/run_pytorch.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/run_pytorch.sh b/scripts/run_pytorch.sh index e662c757..51a05e23 100755 --- a/scripts/run_pytorch.sh +++ b/scripts/run_pytorch.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -e . ~/miniconda3/etc/profile.d/conda.sh conda activate base From 0cc67d6910a03480bd64e8d8f81be591f9ac4089 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Tue, 3 Aug 2021 13:27:20 +0100 Subject: [PATCH 2/2] exit with non-zero error code ? --- scripts/run_pytorch.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/run_pytorch.sh b/scripts/run_pytorch.sh index 51a05e23..5924b9ec 100755 --- a/scripts/run_pytorch.sh +++ b/scripts/run_pytorch.sh @@ -6,6 +6,8 @@ ALL_FILE=$(find *.md ! -name README.md) TEMP_PY="temp.py" CUDAS="nvidia" +declare -i error_code=0 + for f in $ALL_FILE do echo "Running pytorch example in $f" @@ -23,9 +25,12 @@ do else sed -n '/^```python/,/^```/ p' < $f | sed '/^```/ d' > $TEMP_PY python $TEMP_PY + error_code+=$? if [ -f "$TEMP_PY" ]; then rm $TEMP_PY fi fi done + +exit $error_code