git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Josh Triplett <josh@freedesktop.org>
Date
Jul 6, 2007, 03:22 UTC
Message-ID
<468DB570.1090900@freedesktop.org>
In-Reply-To
<20070705135824.GB5493@sigill.intra.peff.net>
Jeff King wrote:
Show 13 quoted lines
> On Wed, Jul 04, 2007 at 03:36:01PM +0100, Johannes Schindelin wrote:
> 
>> 	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
Previous: Jeff KingNext: Johannes Schindelin
Message 9 of 10 in “filter-branch: fail gracefully when a filter fails”
  1. 2/2 filter-branch: fail gracefully when a filter failsJohannes Schindelin, Jul 4, 2007
  2. Jeff KingJul 5, 2007
  3. Johannes SchindelinJul 5, 2007
  4. Junio C HamanoJul 5, 2007
  5. Johannes SixtJul 6, 2007
  6. David KastrupJul 6, 2007
  7. Junio C HamanoJul 6, 2007
  8. Jeff KingJul 6, 2007
  9. Josh TriplettJul 6, 2007
  10. Johannes SchindelinJul 6, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.