Bugzilla – Attachment 99918 Details for
Bug 17532
koha-shell -c does not propagate the error code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17532: Make koha-shell propagate the error code
Bug-17532-Make-koha-shell-propagate-the-error-code.patch (text/plain), 1.55 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-03-02 14:20:28 UTC
(
hide
)
Description:
Bug 17532: Make koha-shell propagate the error code
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-03-02 14:20:28 UTC
Size:
1.55 KB
patch
obsolete
>From 2dc8d79b19a28768e2cd6dc2938b62352b490fb3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 13 Feb 2020 12:03:36 +0100 >Subject: [PATCH] Bug 17532: Make koha-shell propagate the error code > >Context: I am trying to make koha-misc4dev stop when something wrong happens. >Basically we do not want the process to continue of the DB has not been populated correctly. >It will make the errors easier to catch. > >The issue: Say a script that will return an error (die in perl for an easy example), >koha-shell will not return the 255 error code, but 0 instead. >The caller cannot know something wrong happened > >The solution is to propagate the error and make koha-shell return the same error code >as the command it executed > >An example: >=== t.pl === >die('something wrong'); > >% perl t.pl;echo $? >something wrong at t.pl line 1. >255 > >% sudo koha-shell kohadev -p -c 'perl xxx.pl' ; echo $? >something wrong at xxx.pl line 1. >0 > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Tested it with > $ sudo debian/scripts/koha-shell kohadev -c 'exit 8' > $ echo $? > 8 >The unpatched version returns 0 (forgets about the error code). >--- > debian/scripts/koha-shell | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/debian/scripts/koha-shell b/debian/scripts/koha-shell >index 926c04df63..199453ab29 100755 >--- a/debian/scripts/koha-shell >+++ b/debian/scripts/koha-shell >@@ -63,6 +63,8 @@ elsif ( $? & 127 ) { > ( $? & 127 ), ( $? & 128 ) ? 'with' : 'without'; > } > >+exit $? >> 8; >+ > sub show_help { > my ( $err, $msg ) = @_; > >-- >2.25.0
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 17532
:
57055
|
98808
|
99918
|
99943