Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: SIGPIPE (Re: ZSH history not saved anymore)
On Sun, 28 Sep 2014 13:16:27 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sep 28, 7:18pm, Peter Stephenson wrote:
> }
> } So in the first case I presume we're exiting (silently) on SIGPIPE. That
> } should be just a question of checking if SIGPIPE is trapped and if it isn't
> } setting the handler to the default in entersubsh(). There's some partial
> } prior art for this.
>
> It gets a little stranger - this is again before the patch:
>
> torch% TRAPPIPE() { : }
> torch% (sleep 5; echo hello; print -u2 $sysparams[pid] continued after PIPE) |
> (exit)
> TRAPPIPE: write error: broken pipe
> echo: write error: broken pipe
> zsh: write error: broken pipe
> 3579 continued after PIPE
>
>
> Why did TRAPPIPE() receive a SIGPIPE? And then:
I think we're looking at this in execcmd() or similar chunks.
/* It's a builtin */
if (forked)
closem(FDT_INTERNAL);
lastval = execbuiltin(args, (Builtin) hn);
fflush(stdout);
if (save[1] == -2) {
if (ferror(stdout)) {
zwarn("write error: %e", errno);
clearerr(stdout);
}
} else
clearerr(stdout);
so it doesn't necessarily mean there's a signal, just that there's a
broken pipe. Maybe the fflush() is enough to trigger setting errno
again if it failed to write the first time?
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author