From d84e9326694cbf5318db321a01d0f194ca251b25 Mon Sep 17 00:00:00 2001 From: Daniel King Date: Thu, 27 Feb 2020 20:21:59 -0500 Subject: [PATCH] [batch] fix retry of clone I want the function to exit in error if any step fails. I achieve this by starting a sub-shell and setting -e inside that sub shell. That causes the sub-shell to exit if any individual command fails. Previously, the `git clone` could fail but `clone` would still return exit code zero. --- ci/ci/github.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/ci/github.py b/ci/ci/github.py index 510803a2158..e589df6c8c2 100644 --- a/ci/ci/github.py +++ b/ci/ci/github.py @@ -139,13 +139,13 @@ def clone_or_fetch_script(repo): return f""" { RETRY_FUNCTION_SCRIPT } -function clone() {{ +function clone() {{ ( set -e dir=$(mktemp -d) git clone {shq(repo)} $dir for x in $(ls -A $dir); do mv -- "$dir/$x" ./ done -}} +) }} if [ ! -d .git ]; then time retry clone