From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 689331F4C0 for ; Fri, 8 Nov 2019 20:20:20 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] edit: propagate correct editor exit code Date: Fri, 8 Nov 2019 20:20:17 +0000 Message-Id: <20191108202018.15680-2-e@80x24.org> In-Reply-To: <20191108202018.15680-1-e@80x24.org> References: <20191108202018.15680-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: exit($?) is never correct, since ($? >> 8) is needed to extract the correct exit code, as other information (e.g. such as signal) is encoded in $? in addition to the exit code. --- script/public-inbox-edit | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/public-inbox-edit b/script/public-inbox-edit index f2090abf..24b7ed8b 100755 --- a/script/public-inbox-edit +++ b/script/public-inbox-edit @@ -149,7 +149,11 @@ retry_edit: chomp(my $op = || ''); $op = lc($op); goto retry_edit if $op eq 'r'; - exit $? if $op eq 'q'; + if ($op eq 'q') { + # n.b. we'll lose the exit signal, here, + # oh well; "q" is user-specified anyways. + exit($? >> 8); + } last if $op eq 'c'; # continuing print STDERR "\`$op' not recognized\n"; }