zsh-workers
 help / color / mirror / code / Atom feed
From: Samuel Bancal <Samuel.Bancal@epfl.ch>
To: Bart Schaefer <schaefer@brasslantern.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: broken pipe message with setopt PRINT_EXIT_VALUE
Date: Sat, 29 May 2021 08:37:50 +0200	[thread overview]
Message-ID: <1a98aa5b-3620-4be2-f0bf-051e77b9d65e@epfl.ch> (raw)
In-Reply-To: <CAH+w=7a+=gPiFVTuAEXo0b04N-vmT4zMxNX0+MeC==-Kxrp8HA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]

Thanks for these insights.

Yes, I think that behavior makes sense.
I find the solution to run in a subshell really clean and elegant.

Regards,
Samuel

On 28.05.21 23:26, Bart Schaefer wrote:
> On Fri, May 28, 2021 at 1:02 PM Stephane Chazelas <stephane@chazelas.org> wrote:
>> In both cases, tr/yes are being killed (with a SIGPIPE) because
>> they're trying to write to a pipe that has no reader. [...]
>>
>> Which is printed (or rather here the "broken pipe" message
>> corresponding to that death-by-SIGPIPE) because of
>> PRINT_EXIT_VALUE.
> Which is exactly what's supposed to happen when you have that set.
>
> You can run the pipeline in a subshell to suppress this behavior:
>
> ( < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 32; echo )
>
> PRINT_EXIT_VALUE is disabled in subshells because subshells do not
> normally maintain a jobs table like an interactive shell does.
-- 
*Samuel Bancal*
/IT Eng /
*ENAC-IT *
/GR A0 464/
EPFL

ENAC-IT is opening a new branch IT4Research 
<https://www.epfl.ch/schools/enac/about/data-services-en/> /to better 
support our labs in leveraging data in their research! Contact us with 
any questions related to data management, / /data valorization, data 
science and computational tools.
/


[-- Attachment #2.1: Type: text/html, Size: 4504 bytes --]

[-- Attachment #2.2: acacdmolhgnidcmc.png --]
[-- Type: image/png, Size: 984 bytes --]

  reply	other threads:[~2021-05-29  6:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 17:06 Samuel Bancal
2021-05-28 20:01 ` Stephane Chazelas
2021-05-28 21:26   ` Bart Schaefer
2021-05-29  6:37     ` Samuel Bancal [this message]
2021-05-29 11:43     ` Daniel Shahaf
2021-05-29 15:52       ` Bart Schaefer
2021-05-30 12:29         ` Daniel Shahaf
2021-05-30 17:44           ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a98aa5b-3620-4be2-f0bf-051e77b9d65e@epfl.ch \
    --to=samuel.bancal@epfl.ch \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).