develooper Front page | perl.perl5.porters | Postings from June 2008

RE: Generic system() replacements

Thread Previous | Thread Next
From:
Jan Dubois
Date:
June 17, 2008 18:58
Subject:
RE: Generic system() replacements
Message ID:
0a1f01c8d0e6$d694f180$83bed480$@com
On Tue, 17 Jun 2008, Paul Fenwick wrote:

> * Returns the exit value of the process (the full 16 bits on Windows),
>   rather than requiring pain and suffering with $?.

On Windows the full exit status is actually a signed 32-bit integer,
so it doesn't even fit into $?.  I think we should implement
${^CHILD_ERROR_NATIVE} on Windows to hold the full value (VMS already
does this).

There is also another bug in the Windows system() implementation in
that it will execute a program twice if it returns a status of -1
because that value is used internally to mark a failed invocation.

>>> * Multi-arg system() never invokes the shell under Win32, even
>>>   though CORE::system will.
>>
>> Another semantics change -- though I'll admit this one just might be
>> an improvement.
>
> I actually consider multi-arg system calling the shell under Win32 to
> be a bug[1]. It happens as a fallback when Perl can't find the
> command itself.

I agree with this.  I'll try to check with Sarathy to see if he remembers
why it was done the way it is right now.

> In the next release, there will be an interface to get the exit value,
> signal name, signal number, and core dump status, along with a mechanism to
> supply your own $?.  Suggestions for better names than unpack_child_error()
> are welcome! ;)

Isn't POSIX::WEXITSTATUS() what you are looking for?  I'm not sure if
it works correctly on Windows, but it would probably be best to fix it
there.

Cheers,
-Jan



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About