Re: run "...", :out forgetting about the exit code?
Nitpick: 'use strict' is the default. On 2016-02-03 03:07:18 IRST, Peter Pentchev wrote: > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false"; say > $p.exitcode;'
Re: run "...", :out forgetting about the exit code?
On Tue, Feb 02, 2016 at 06:41:12PM -0500, Brandon Allbery wrote: > On Tue, Feb 2, 2016 at 6:37 PM, Peter Pentchev wrote: > > > So, uhm, what am I missing? Shouldn't $p.exitcode remain 1 no matter > > whether > > I've invoked run() with or without :out? Should I file a bug? > > > > https://rt.perl.org/Ticket/Display.html?id=125757 Oof, right. Yeah, as witnessed by my other mail, I did realize that the process was still running. Still, as mentioned there, http://doc.perl6.org/type/Proc#method_exitcode says something about -1 if the process has not exited yet; I guess that's what threw me. Thanks, and sorry for not looking through RT! G'luck, Peter -- Peter Pentchev r...@ringlet.net r...@freebsd.org p...@storpool.com PGP key:http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13 signature.asc Description: PGP signature
Re: run "...", :out forgetting about the exit code?
On Wed, Feb 03, 2016 at 01:37:18AM +0200, Peter Pentchev wrote: > Hi, > > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false"; say > $p.exitcode;'1 > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false", > :out; say $p.exitcode;' > 0 > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false", > :out; print $p.out.slurp-rest; say $p.exitcode;' > 0 > [roam@straylight ~]$ > > So, uhm, what am I missing? Shouldn't $p.exitcode remain 1 no matter whether > I've invoked run() with or without :out? Should I file a bug? > > It doesn't matter whether the program actually produces any output on > the standard output stream: > > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "sh", "-c", > "env LANG=C date; exit 3"; say $p.exitcode;' > > Wed Feb 3 01:34:50 EET 2016 > 3 > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "sh", "-c", > "env LANG=C date; exit 3", :out; say "<<<" ~ $p.out.slurp-rest ~ ">>>"; say > $p.exitcode;' > > << >>> > 0 > [roam@straylight ~]$ Hm. Okay. I think I figured it out. When I added a $p.out.close call to make sure that the process has *really* exited, it threw a X::Proc::Unsuccessful exception at me right there. For some reason I thought that assigning the process to a variable would protect me from the exception. However, I'm still a bit confused - the Proc documentation seems to say that exitcode() will return -1, not 0, if the process has not ended yet. Is this the real problem here? G'luck, Peter -- Peter Pentchev r...@ringlet.net r...@freebsd.org p...@storpool.com PGP key:http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13 signature.asc Description: PGP signature
Re: run "...", :out forgetting about the exit code?
On Tue, Feb 2, 2016 at 6:37 PM, Peter Pentchev wrote: > So, uhm, what am I missing? Shouldn't $p.exitcode remain 1 no matter > whether > I've invoked run() with or without :out? Should I file a bug? > https://rt.perl.org/Ticket/Display.html?id=125757 -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
Re: run "...", :out forgetting about the exit code?
On Wed, Feb 03, 2016 at 01:37:18AM +0200, Peter Pentchev wrote: > Hi, > > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false"; say > $p.exitcode;'1 > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false", > :out; say $p.exitcode;' > 0 > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false", > :out; print $p.out.slurp-rest; say $p.exitcode;' > 0 > [roam@straylight ~]$ > > So, uhm, what am I missing? Shouldn't $p.exitcode remain 1 no matter whether > I've invoked run() with or without :out? Should I file a bug? Just for the record, my $p = Proc.new(:out); $p.spawn(...); behaves in exactly the same way (no big surprise there, just thought I'd check). G'luck, Peter -- Peter Pentchev r...@ringlet.net r...@freebsd.org p...@storpool.com PGP key:http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13 signature.asc Description: PGP signature
run "...", :out forgetting about the exit code?
Hi, [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false"; say $p.exitcode;'1 [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false", :out; say $p.exitcode;' 0 [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false", :out; print $p.out.slurp-rest; say $p.exitcode;' 0 [roam@straylight ~]$ So, uhm, what am I missing? Shouldn't $p.exitcode remain 1 no matter whether I've invoked run() with or without :out? Should I file a bug? It doesn't matter whether the program actually produces any output on the standard output stream: [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "sh", "-c", "env LANG=C date; exit 3"; say $p.exitcode;' Wed Feb 3 01:34:50 EET 2016 3 [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "sh", "-c", "env LANG=C date; exit 3", :out; say "<<<" ~ $p.out.slurp-rest ~ ">>>"; say $p.exitcode;' <<>> 0 [roam@straylight ~]$ This happens absolutely reproducibly on all of the following: This is Rakudo version 2015.12 built on MoarVM version 2015.12 implementing Perl 6.c. This is Rakudo version 2016.01 built on MoarVM version 2016.01 implementing Perl 6.c. This is Rakudo version 2016.01.1 built on MoarVM version 2016.01 implementing Perl 6.c. My system is Debian testing: Linux straylight 4.3.0-1-amd64 #1 SMP Debian 4.3.3-5 (2016-01-04) x86_64 GNU/Linux Thanks in advance for any clarifications, including "what the *bleep*, just read this line of the documentation already!" :) G'luck, Peter -- Peter Pentchev r...@ringlet.net r...@freebsd.org p...@storpool.com PGP key:http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13 signature.asc Description: PGP signature