From c9f2f3f5b3497f06f8f40256b40489cfd699f0b5 Mon Sep 17 00:00:00 2001 From: Evan Giles Date: Fri, 1 Sep 2023 18:42:45 +1200 Subject: [PATCH] Bug 34653: Make koha-foreach return the correct status code I think the correct behavior for this script should be that koha-foreach will return success if all the commands it tried to run succeeded, but failure if any of the commands failed. To test: 0) `koha-foreach /bin/true; echo $?` 1) Note that the exit status is 0 2) `koha-foreach /bin/false; echo $?` 3) Note that the exit status is 0 (incorrect) 4) Apply patch 5) `koha-foreach /bin/true; echo $?` 6) Note that the exit status is 0 7) `koha-foreach /bin/false; echo $?` 8) Note that the exit status is 1 (correct) --- debian/scripts/koha-foreach | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/scripts/koha-foreach b/debian/scripts/koha-foreach index d2e98dd7de..8672a63446 100755 --- a/debian/scripts/koha-foreach +++ b/debian/scripts/koha-foreach @@ -51,6 +51,7 @@ do shift done +rv=0 for name in $(koha-list $listopts) do # Replace the __instancename__ placeholder for the instance name (Bug 8566) @@ -73,4 +74,4 @@ do fi done -exit 0 +exit $rv -- 2.34.1