From 78cd27df781aa5eba37fc6d215c389a59979eadd Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Mon, 16 Oct 2017 22:14:01 -0400 Subject: [PATCH] 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 --- shell/sign | 5 +++++ 1 file changed, 5 insertions(+) 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[*]} -- 2.16.6