Bugzilla – Attachment 105636 Details for
Bug 25634
koha-foreach exits too early if any command has non-zero status
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25634: [Alternate] Warn if koha-shell returns non-zero in koha-foreach
Bug-25634-Alternate-Warn-if-koha-shell-returns-non.patch (text/plain), 1.68 KB, created by
Kyle M Hall (khall)
on 2020-06-08 11:08:04 UTC
(
hide
)
Description:
Bug 25634: [Alternate] Warn if koha-shell returns non-zero in koha-foreach
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-06-08 11:08:04 UTC
Size:
1.68 KB
patch
obsolete
>From 69c5ac783a456335d0a4ff096fd891cc4ee87835 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Tue, 2 Jun 2020 09:53:06 +1000 >Subject: [PATCH] Bug 25634: [Alternate] Warn if koha-shell returns non-zero in > koha-foreach > >By putting koha-shell in an if statement, "set -e" will no longer >cause the entire koha-foreach program to exit, if koha-shell >returns a non-zero status. > >If a non-zero status is returned, we warn on it, and the caller >of koha-foreach can interpret that command visually. > >To Test: >1) Write a shell script that says "Hello" and then exits with a 1 >status >2) Run koha-foreach against that shell script with multiple instances >available to koha-foreach >3) Before the patch, koha-foreach will die after the first "Hello" >4) After the patch, koha-foreach will continue, through all the >instances, and report which instances returned non-zero statuses >by which command. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > debian/scripts/koha-foreach | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > >diff --git a/debian/scripts/koha-foreach b/debian/scripts/koha-foreach >index 9682f14b85..2f5a150fcb 100755 >--- a/debian/scripts/koha-foreach >+++ b/debian/scripts/koha-foreach >@@ -61,7 +61,12 @@ do > # Change to the instance's home dir if required > [ "$chdir" != "no" ] && eval cd ~$name"-koha" > >- koha-shell ${name} -c "${cmd}" >+ if koha-shell ${name} -c "${cmd}"; then >+ : #noop >+ else >+ rv=$? >+ echo "${name}: $rv status returned by \"${cmd}\"" >+ fi > > # Go back to the original dir if required > [ "$chdir" != "no" ] && cd "$starting_dir" >-- >2.24.1 (Apple Git-126)
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 25634
:
105453
|
105478
|
105636
|
105648