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

Re: [PATCH] Ignore SIGPIPE when running a filter driver

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 20, 2012, 22:11 UTC
Message-ID
<7vsji5jgtv.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1329771217-9088-1-git-send-email-jehan@orb.com>
Jehan Bing <jehan@orb.com> writes:
Show 26 quoted lines
> diff --git a/convert.c b/convert.c
> index c06309f..5d312cb 100644
> --- a/convert.c
> +++ b/convert.c
> @@ -2,6 +2,7 @@
>  #include "attr.h"
>  #include "run-command.h"
>  #include "quote.h"
> +#include "sigchain.h"
>  
>  /*
>   * convert.c - convert a file when checking it out and checking it in.
> @@ -360,12 +361,16 @@ static int filter_buffer(int in, int out, void *data)
>  	if (start_command(&child_process))
>  		return error("cannot fork to run external filter %s", params->cmd);
>  
> +	sigchain_push(SIGPIPE, SIG_IGN);
> +
>  	write_err = (write_in_full(child_process.in, params->src, params->size) < 0);
>  	if (close(child_process.in))
>  		write_err = 1;
>  	if (write_err)
>  		error("cannot feed the input to external filter %s", params->cmd);
>  
> +	sigchain_pop(SIGPIPE);
> +
Thanks.

I think this is OK on a POSIX system where this function is run by start_async() which is implemented with a forked child process.

I do not now if it poses a issue on Windows, though. Johannes, any comments?

Previous: Jehan BingNext: Johannes Sixt
Message 2 of 5 in “Ignore SIGPIPE when running a filter driver”
  1. Ignore SIGPIPE when running a filter driverJehan Bing, Feb 20, 2012
  2. Junio C HamanoFeb 20, 2012
  3. Johannes SixtFeb 21, 2012
  4. Jonathan NiederFeb 21, 2012
  5. Junio C HamanoFeb 21, 2012

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.