[Issue 9444] New: shell doesn't throw on error.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 2 18:27:18 PST 2013


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

           Summary: shell doesn't throw on error.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: thelastmammoth at gmail.com


--- Comment #0 from thelastmammoth at gmail.com 2013-02-02 18:27:14 PST ---
The doc for std.process.shell says "If the process could not be started or
exits with an error code, throws an exception."

However on OSX I'm having a different kind of behavior.
---
import std.process;
import std.stdio;

void main(){
    shell("asfasfasdfasdf");
    writeln("ok");
}
---
prints:

in dmd.2.061 - 2.059:
sh: asfasfasdfasdf: command not found
ok

in dmd.2.057:
sh: asfasfasdfasdf: command not found
std.exception.ErrnoException at std/stdio.d(418): Could not close pipe
`asfasfasdfasdf' (Undefined error: 0)

Note:
I had originally reported the problem here: "shell doesn't throw on error. Is
that a regression?"

As Andrej Mitrovic said, the unittest is pretty bad and incomplete:
unittest
{
   auto x = shell("echo wyda");
}


On another note, would it be possible to capture std err as well as std out
instead of printing std err ? for example returning a tuple? Since we don't
wanna change interface, maybe a different function shell_capture.

-- 
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