in reply to Re^3: system and $?
in thread system and $?

You have a broken Perl if that's true.

Well, it's pretty easy to reproduce, and the effect is the same in ActiveState 5.8.8 und 5.10. If I find the time, I'll try it with Strawberry...

The shell cannot possibly change the parent's errno.
Certainly not. It would need to communicate the information in a different way to the parent process. Well, this is a theoretical question, because Perl - likely in order to be portable - is not programmed that way, but: If it would be possible on Windows to somehow get the full (i.e. 32 Bit) Exitcode, we could use this information: If the shell can't execute a program, it sets this exitcode to 9009.

OTOH, this would still make it indistinguishable from a program which deliberately sets that exit code..

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^5: system and $?
by ikegami (Patriarch) on Aug 26, 2009 at 14:22 UTC

    Well, it's pretty easy to reproduce, and the effect is the same in ActiveState 5.8.8 und 5.10.

    I used ActivePerl 5.10.0 b1005 above. 5.8.8 gives the same result. Both successfully execute the shell, so $? is not -1, so $! is meaningless.

    OTOH, this would still make it indistinguishable from a program which deliberately sets that exit code..

    Yes.