Bugzilla – Attachment 155777 Details for
Bug 34653
Make koha-foreach return the correct status code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34653: Make koha-foreach return the correct status code
Bug-34653-Make-koha-foreach-return-the-correct-sta.patch (text/plain), 1.76 KB, created by
David Nind
on 2023-09-18 03:08:18 UTC
(
hide
)
Description:
Bug 34653: Make koha-foreach return the correct status code
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-09-18 03:08:18 UTC
Size:
1.76 KB
patch
obsolete
>From 497a5968196033d9c7fd47b11b55cc8781ffe0a6 Mon Sep 17 00:00:00 2001 >From: Evan Giles <evan@catalyst.net.nz> >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 0 (success) if all the commands it tried to run succeeded, but >1 (failure) if any of the commands failed. > >To test: >1. $ koha-create --create-db test >2. $ vi test.sh >if [ $USER = 'kohadev-koha' ]; then > echo "FAILED"; > exit 1; >else > echo "SUCCESS"; > exit 0; >fi > >3. $ debian/scripts/koha-foreach sh test.sh >FAILED >kohadev: 1 status returned by "sh test.sh" >SUCCESS >4. $ echo $? >5. Note that the exit status is 0 (success) > >6. Apply patch > >7. $ debian/scripts/koha-foreach sh test.sh >FAILED >kohadev: 1 status returned by "sh test.sh" >SUCCESS >8. $ echo $? >9. Note that the exit status is 1 (failure) > >Signed-off-by: David Nind <david@davidnind.com> >--- > debian/scripts/koha-foreach | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/debian/scripts/koha-foreach b/debian/scripts/koha-foreach >index d2e98dd7de..66f8757d4f 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) >@@ -64,8 +65,8 @@ do > if koha-shell ${name} -c "${cmd}"; then > : #noop > else >- rv=$? >- echo "${name}: $rv status returned by \"${cmd}\"" >+ echo "${name}: $? status returned by \"${cmd}\"" >+ rv=1 > fi > > # Go back to the original dir if required >@@ -73,4 +74,4 @@ do > fi > done > >-exit 0 >+exit $rv >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34653
:
155160
|
155248
|
155770
|
155777
|
156042