Thread (7 messages) flat view 7 messages, 5 authors, 2016-06-15

Re: [PATCH 2/2] filter-branch: fail gracefully when a filter fails

From: Josh Triplett <hidden>
Date: 2016-06-15 22:43:19

Jeff King wrote:
On Wed, Jul 04, 2007 at 03:36:01PM +0100, Johannes Schindelin wrote:
quoted
	It is slightly ugly that the output of msg-filter is written
	to a temporary file. But I do not know a better method to
	catch a failing msg-filter. Help?
If you mean, in general, to catch the exit code of the first part of a
pipe, you have to do something like this:

status=`((cmd1; echo $? >&3) | cmd2) 3>&1`

which is pretty ugly in itself, and if you want the stdout of cmd2, then
you have to add even more redirection. I'm not sure it's worth it.
bash has "set -o pipefail", but that would require bash.  However, you could
try setting pipefail, and ignoring any failure to set it; that would give the
more friendly behavior with bash, while still allowing any /bin/sh in general.

- Josh Triplett

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help