[Issue 6926] std.process.system return wrong exit code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 24 22:11:31 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6926


hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh at quickfur.ath.cx


--- Comment #1 from hsteoh at quickfur.ath.cx 2012-02-24 22:11:29 PST ---
There are several issues here.

1) According to the current docs, std.process.system returns the value of
WEXITSTATUS(status), and in this case, the value of this macro is indeed 0 (as
I checked on my Linux system).

2) Which brings me to the next point: the current implementation of system() in
Phobos assumes a particular definition of WEXITSTATUS. It works on Linux, but
there's no guarantee it will work on other Posix systems because they may
define WEXITSTATUS differently. (But I may wrong, based on a comment in glibc
that essentially says the current definition is across the all known unixen, in
spite of the Posix spec leaving this open to interpretation.)

3) But more importantly, should we return non-zero if the child exits via a
signal? If so, we need std.process.system to check the value of
WIFSIGNALED(status) and possibly WCOREDUMP(status), and return a meaningful
value (maybe -1?).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list