in reply to Re: system >> 8 is non-zero when child exits with exit(0)
in thread system >> 8 is non-zero when child exits with exit(0)
Thanks for your thoughts!
I have been checking the full value returned from system as well - I should have mentioned that.
This is a new one on me - I've not seen it in 20 something years of working with perl. I agree that there's something happening in the child process (ie I'm quite sure the return value of system is correct), however the very last thing to happen in these failing processes is basically:
logprint("Process completed successfully"); exit(0); # As part of testing we've even added exit with an explicit 0 + as here
And yet the calling processing detects a non-zero return code - and (having been logging this return code in detail) it is always a return code of 1 (after >>8) or to quote some debugging output we've added:
DEBUG TEST 1 uses the if/then/else described in perldoc -f system: DEBUG TEST 1 CASE(else): child exited with value 1 DEBUG TEST 2 uses the POSIX::W* checks of perlvar ${^CHILD_ERROR_NATIV +E} which is: 256 (binary: 0000000100000000) DEBUG TEST 2: POSIX::WIFEXITED returned true (child exited normally) DEBUG TEST 2: POSIX::WEXITSTATUS returned: 1 (binary: 0000000000000001 +)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: system >> 8 is non-zero when child exits with exit(0)
by haukex (Archbishop) on Mar 09, 2021 at 15:09 UTC | |
by bjdean (Novice) on Mar 10, 2021 at 03:42 UTC | |
by haukex (Archbishop) on Mar 11, 2021 at 19:26 UTC | |
by bjdean (Novice) on Mar 17, 2021 at 01:01 UTC | |
by jcb (Parson) on Mar 11, 2021 at 02:38 UTC | |
by bjdean (Novice) on Mar 17, 2021 at 00:42 UTC |