www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6926] New: std.process.system return wrong exit code

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6926

           Summary: std.process.system return wrong exit code
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: mihail.zenkov gmail.com



PST ---
std.process.system should return non-zero exit code when it stopped by ctrl+c.
Simple test:

import std.stdio;
import std.process;

void main() {
int ret = system("sleep 10");
writeln("RET ", ret);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 09 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6926


hsteoh quickfur.ath.cx changed:

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



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: -------
Feb 24 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6926




https://github.com/D-Programming-Language/phobos/pull/460

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6926




Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/41e6decef90b2f598b2e796a73ddfa34cb668566


Code cleanup & fix issue 6926

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6926


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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