-
Notifications
You must be signed in to change notification settings - Fork 1
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
shell().exitcode is always 0 when :out is used #4456
Comments
From @hoelzroSee the attached script. |
From @hoelzroOn 2015-08-05 10:32:54, rob@hoelz.ro wrote:
Same goes for run(). |
From @ugexeOn Wed Aug 05 10:32:54 2015, rob@hoelz.ro wrote:
It works if you close the file handle: perl6 -e 'my $p = shell("false", :out); $p.out.close; say $p.exitcode' |
From @FROGGSShall we attempt to make the exitcode (Int) until we got one? |
The RT System itself - Status changed from 'new' to 'open' |
From @hoelzroOn 2015-08-05 23:20:24, FROGGS.de wrote:
That seems reasonable. |
From @AlexDanielFirst of all, let's look at the code that works: Result: Correct! OK, now let's say I want to have the output as well: Result: But the exitcode is clearly not 0. It turns out that you have to close .out in order to get it to work: I think that it's fine if the exitcode is -1 until it is closed, yet I |
From nxadm@apt-get.beOn Wed 05 Aug 2015 11:21:05, ugexe@cpan.org wrote:
There seem to be a regression: [claudio:~/tmp] 1 $ perl6 -v This mean that real exit code when non-zero can not be retrieved. Adding a CATCH block can go around the chicken-and-egg problem: exitcode can only be tested after close, but close throws an exception when exitcode is non-zero. However, this will no retrieve the real exitcode. C. |
From @lucsOn Wed Jan 06 05:56:24 2016, nxadm wrote:
Please note that assigning the result of the close() makes it work: $ perl6 -v |
From @ugexeThe assignment fix can be simplified further: I would expect these 3 examples to have the same result. The actual results are `True, True, The spawned process exited unsuccessfully (exit code: 1)` On Sun Jan 24 03:15:58 2016, scullucs wrote:
|
From @briandfoyIt seems that the exit value that a Proc object returns isn't use Test; my $program = '/usr/bin/false'; # maybe yours is different ok $program.IO.e, 'program exists'; subtest { subtest { subtest { subtest { done-testing(); And, the output: ok 1 - program exists # Failed test 'Output specified, check exit before read' # Failed test 'run with :out argument, read after' # Failed test 'Output, check exit after read' # Failed test 'run with :out argument, read first' # Failed test 'Output, check exit after read' # Failed test 'run with :out argument, read first' The details: $ perl6 -v && uname -a |
From @AlexDanielDup of 125757 On 2017-01-26 18:08:59, comdog wrote:
|
The RT System itself - Status changed from 'new' to 'open' |
From @timoHey Brian, here's a version of your test code that works: use Test; my $program = '/usr/bin/false'; # maybe yours is different ok $program.IO.e, 'program exists'; subtest { subtest { subtest { subtest { done-testing(); Output: ok 1 - program exists you need to pass :close to slurp-rest so that it closes the output pipe, otherwise your program will keep running and won't actually exit. Please note that i also re-ordered things in the second subtest. There's been discussion that running .exitcode either while the program is still running or while out/err aren't closed should throw an exception immediately. |
From @zoffixznetOn Thu, 18 Feb 2016 09:51:34 -0800, ugexe@cpan.org wrote:
Or even simpler: $ perl6 -e 'my $p = shell("false", :out); $p.out.close.exitcode.say' .close doesn't throw as some above suggested. It returns the Proc object and sunk Proc with non-zero exitcode throws. |
From @ugexeThis has been resolved since 2017.06 |
@ugexe is correct, this seems to be fixed! Fix bisected: (2017-06-12) rakudo/rakudo@92bd7e4 I think we still need a test for this! |
This is the same issue that was fixed at the same time: #6072 |
Migrated from rt.perl.org#125757 (status was 'open')
Searchable as RT125757$
The text was updated successfully, but these errors were encountered: