Front page | perl.perl6.users |
Postings from August 2022
questions about sigpipe
From:
Marc Chantreux
Date:
August 8, 2022 17:19
Subject:
questions about sigpipe
Message ID:
YvFFpRztTCCB46EX@prometheus.u-strasbg.fr
hello Rakoons,
I found the sigpipe module [S13] while reading the Rakudo Weekly
news[rwn] so Raku can handle SIGPIPE the way I think is the good one:
raku -e 'loop { say "y"}' | sed 3q
# some weird error
raku -Msigpipe -e 'loop { say "y"}' | sed 3q
# just works
rwn: https://rakudoweekly.blog/2022/08/08/2022-32-2nd-conf/
S13: https://raku.land/zef:leont/sigpipe
so now I have this 6 wrapper to make raku more unixish:
6() RAKUDO_ERROR_COLOR= raku -Msigpipe "$@"
RAKUDO_ERROR_COLOR must be set because raku prints escape caracters in
stderr by default, no matter if it is a tty. I never complained about it
but I think of it as a bug.
Also considered as a bug here was the default sigpipe handler
raku -Msigpipe -e 'loop { say "y"}' | sed 3q
Just works "as expected" and I don't know why Raku took so long to
handle it this way. leont gave me the begin of the answer in the
documentation of the module:
«Raku's default sigpipe handling does the sensible things for
networking applications, but entirely the wrong thing for CLI
applications.»
Can anyone give more detail about it?
Thanks for any answer and regards,
PS: sigpipe is also a nice example of usage for INIT and NativeCall.
--
Marc Chantreux
Pôle de Calcul et Services Avancés à la Recherche (CESAR)
http://annuaire.unistra.fr/p/20200
-
questions about sigpipe
by Marc Chantreux