public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] cygport: propagate exit status
@ 2016-04-06 13:05 Jon Turney
  2016-04-07 17:32 ` Yaakov Selkowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Turney @ 2016-04-06 13:05 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

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 <jon.turney@dronecode.org.uk>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] cygport: propagate exit status
  2016-04-06 13:05 [PATCH] cygport: propagate exit status Jon Turney
@ 2016-04-07 17:32 ` Yaakov Selkowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Yaakov Selkowitz @ 2016-04-07 17:32 UTC (permalink / raw)
  To: cygwin-apps

On 2016-04-06 08:04, Jon Turney wrote:
> 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.

Thanks, merged and pushed.

-- 
Yaakov

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-07 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 13:05 [PATCH] cygport: propagate exit status Jon Turney
2016-04-07 17:32 ` Yaakov Selkowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).