From: Thanh Ha Date: Tue, 17 Oct 2017 02:14:01 +0000 (-0400) Subject: Fail gracefully when no files to sign X-Git-Tag: v0.11.0~5 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F31%2F6931%2F2;p=releng%2Flftools.git Fail gracefully when no files to sign Fixes issue where if there are no files to sign detected the script just hangs indefinitely. Instead if the files_to_sign array is empty then exit 1 and inform user. Change-Id: I82a5957faedfe739800305a8224fed67d2c74801 Signed-off-by: Thanh Ha --- diff --git a/shell/sign b/shell/sign index 4000bbfa..1839546c 100755 --- a/shell/sign +++ b/shell/sign @@ -66,6 +66,11 @@ sign_dir() { ! -name "maven-metadata-local.xml" \ ! -name "maven-metadata.xml")) + if [ "${#files_to_sign[@]}" -eq 0 ]; then + echo "ERROR: No files to sign. Quitting..." + exit 1 + fi + if hash parallel 2>/dev/null; then echo "Signing in parallel..." parallel --jobs 200% --halt now,fail=1 "$GPG_BIN --batch -abq {}" ::: ${files_to_sign[*]}