From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53817 invoked by alias); 6 Apr 2016 13:05:20 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 53801 invoked by uid 89); 6 Apr 2016 13:05:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Packaging, D*org.uk, Installing, Hx-spam-relays-external:CriticalPath X-HELO: rgout0407.bt.lon5.cpcloud.co.uk Received: from rgout0407.bt.lon5.cpcloud.co.uk (HELO rgout0407.bt.lon5.cpcloud.co.uk) (65.20.0.220) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Apr 2016 13:05:09 +0000 X-OWM-Source-IP: 86.179.113.247 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-CTCH-RefID: str=0001.0A090204.57050983.008E,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-Junkmail-Premium-Raw: score=27/50,refid=2.7.2:2016.3.30.105115:17:27.888,ip=86.179.113.247,rules=__HAS_FROM, __TO_MALFORMED_2, __TO_NO_NAME, __SUBJ_ALPHA_END, __HAS_MSGID, __SANE_MSGID, __HAS_X_MAILER, __ANY_URI, __URI_NO_WWW, __FRAUD_MONEY_CURRENCY_DOLLAR, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, __URI_NS, SXL_IP_DYNAMIC[247.113.179.86.fur], HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, RDNS_SUSP, BODY_SIZE_7000_LESS, NO_URI_HTTPS X-CTCH-Spam: Unknown Received: from localhost.localdomain (86.179.113.247) by rgout04.bt.lon5.cpcloud.co.uk (8.6.122.06) (authenticated as jonturney@btinternet.com) id 56F68F500137AFC7; Wed, 6 Apr 2016 14:04:06 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH] cygport: propagate exit status Date: Wed, 06 Apr 2016 13:05:00 -0000 Message-Id: <1459947884-13280-1-git-send-email-jon.turney@dronecode.org.uk> X-SW-Source: 2016-04/txt/msg00005.txt.bz2 The commands compile, check, inst, package and all currently return the exit status of the last command in the pipeline, tee, which they pass their output through. I guess we don't want to just turn on pipefail, since pkg_pkg very carefully turns it on and off in a particular place, so use $PIPESTATUS to propagate the much more interesting exit status of the command who's output is tee'd. Signed-off-by: Jon Turney --- bin/cygport.in | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/cygport.in b/bin/cygport.in index b032b8b..4abca88 100644 --- a/bin/cygport.in +++ b/bin/cygport.in @@ -561,19 +561,19 @@ do __log_init ${compilelog}; __check_depends && \ src_compile 2>&1 | tee -a ${compilelog}; - _status=$?; + _status=${PIPESTATUS[0]}; ;; check|test) __stage Testing; __log_init ${checklog}; src_test 2>&1 | tee -a ${checklog}; - _status=$?; + _status=${PIPESTATUS[0]}; ;; inst*) __stage Installing; __log_init ${installlog}; (__prepinstalldirs && src_install && __src_postinst) 2>&1 | tee -a ${installlog}; - _status=$?; + _status=${PIPESTATUS[0]}; ;; postinst*) __src_postinst; @@ -603,7 +603,7 @@ do __stage Packaging; __log_init ${pkglog}; (__pkg_binpkg && __pkg_pkgcheck && __pkg_srcpkg && __pkg_dist) 2>&1 | tee -a ${pkglog}; - _status=$?; + _status=${PIPESTATUS[0]}; ;; diff|mkdiff|mkpatch) __pkg_diff; @@ -613,7 +613,7 @@ do __stage Uploading; __log_init ${uploadlog}; (__pkg_upload) 2>&1 | tee -a ${uploadlog}; - _status=$?; + _status=${PIPESTATUS[0]}; ;; announce) __stage "Preparing announcement"; @@ -629,10 +629,13 @@ do __log_init ${compilelog} && \ __check_depends && \ __stage Compiling && src_compile 2>&1 | tee -a ${compilelog} && \ + test ${PIPESTATUS[0]} -eq 0 && \ __log_init ${installlog} && \ __stage Installing && (__prepinstalldirs && src_install && __src_postinst) 2>&1 | tee -a ${installlog} && \ + test ${PIPESTATUS[0]} -eq 0 && \ __log_init ${pkglog} && \ - __stage Packaging && (__pkg_binpkg && __pkg_pkgcheck && __pkg_srcpkg && __pkg_dist) 2>&1 | tee -a ${pkglog} + __stage Packaging && (__pkg_binpkg && __pkg_pkgcheck && __pkg_srcpkg && __pkg_dist) 2>&1 | tee -a ${pkglog} && \ + test ${PIPESTATUS[0]} -eq 0 _status=$?; ;; help) -- 2.7.4