Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proc::Async's .write appears to exit when the process run doesn't exist #5415

Closed
p6rt opened this issue Jul 3, 2016 · 7 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 3, 2016

Migrated from rt.perl.org#128526 (status was 'resolved')

Searchable as RT128526$

@p6rt
Copy link
Author

p6rt commented Jul 3, 2016

From @MasterDuke17

This works like it should​:

perl6 -e 'my $p; try {$p = Proc​::Async.new("asdfcat", </path/to/file that
exists>); CATCH {die "in new"}}; my $pr; try {$pr = $p.start; CATCH {die
"in start"}}; try {await($pr); CATCH {die "in await"}}'
in await
  in block at -e line 1
  in block <unit> at -e line 1

This doesn't​:

perl6 -e 'my $p; try {$p = Proc​::Async.new(​:w, "asdfcat"); CATCH {die "in
new"}}; my $pr; try {$pr = $p.start; CATCH {die "in start"}}; try
{await($p.write("hi\n".encode)); CATCH {die "in write"}}; try
{$p.close-stdin; CATCH {die "in close"}}; try {await($pr); CATCH {die "in
await"}}'

@p6rt
Copy link
Author

p6rt commented Jul 9, 2016

From @zoffixznet

It's actually not throwing anything. The .write just seems to exit​:

$ perl6 -e 'my $p = Proc​::Async.new(​:w, "fdadsfdsafsd"); my $prom = $p.start; say "BEFORE"; say $p.write​: "meow".encode; say "AFTER"; say await $prom;'
BEFORE

I've seen this bug examined on IRC, but I don't see a ticket for it.

@p6rt
Copy link
Author

p6rt commented Jul 9, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 28, 2016

From @geekosaur

On Sun, Jul 3, 2016 at 10​:22 AM, Daniel Green <perl6-bugs-followup@​perl.org>
wrote​:

This doesn't​:

perl6 -e 'my $p; try {$p = Proc​::Async.new(​:w, "asdfcat"); CATCH {die "in
new"}}; my $pr; try {$pr = $p.start; CATCH {die "in start"}}; try
{await($p.write("hi\n".encode)); CATCH {die "in write"}}; try
{$p.close-stdin; CATCH {die "in close"}}; try {await($pr); CATCH {die "in
await"}}'

zsh​: exit 141
pyanfar Z$ grep $((141 - 128)) /usr/include/asm-generic/signal.h
#define SIGPIPE 13

I think I'd call that expected behavior.

--
brandon s allbery kf8nh sine nomine associates
allbery.b@​gmail.com ballbery@​sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

@p6rt
Copy link
Author

p6rt commented Mar 8, 2017

From @jnthn

On Sun, 03 Jul 2016 07​:22​:09 -0700, ddgreen@​gmail.com wrote​:

This works like it should​:

perl6 -e 'my $p; try {$p = Proc​::Async.new("asdfcat", </path/to/file that
exists>); CATCH {die "in new"}}; my $pr; try {$pr = $p.start; CATCH {die
"in start"}}; try {await($pr); CATCH {die "in await"}}'
in await
in block at -e line 1
in block <unit> at -e line 1

This doesn't​:

perl6 -e 'my $p; try {$p = Proc​::Async.new(​:w, "asdfcat"); CATCH {die "in
new"}}; my $pr; try {$pr = $p.start; CATCH {die "in start"}}; try
{await($p.write("hi\n".encode)); CATCH {die "in write"}}; try
{$p.close-stdin; CATCH {die "in close"}}; try {await($pr); CATCH {die "in
await"}}'

Fixed and tested in S17-procasync/nonexistent.t. (The change is to default to ignoring SIGPIPE, since we error-check all operations anyway. Those who do want to exit on SIGPIPE can write `signal(SIGPIPE).tap​: { exit 1 }` or so.

@p6rt
Copy link
Author

p6rt commented Mar 8, 2017

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Mar 8, 2017
@p6rt
Copy link
Author

p6rt commented Mar 8, 2017

From @geekosaur

On Wed, Mar 8, 2017 at 11​:33 AM, jnthn@​jnthn.net via RT <
perl6-bugs-followup@​perl.org> wrote​:

Fixed and tested in S17-procasync/nonexistent.t. (The change is to default
to ignoring SIGPIPE, since we error-check all operations anyway. Those who
do want to exit on SIGPIPE can write `signal(SIGPIPE).tap​: { exit 1 }` or
so.

Hm. I'm going to guess this will interact badly with use as part of a shell
pipeline.

--
brandon s allbery kf8nh sine nomine associates
allbery.b@​gmail.com ballbery@​sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

@p6rt p6rt added the conc label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant