Bug 9444 – Regression (2.059): shell doesn't throw on error.
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2013-02-02T18:27:00Z
Last change time
2013-02-14T19:10:31Z
Assigned to
andrej.mitrovich
Creator
thelastmammoth
Comments
Comment #0 by thelastmammoth — 2013-02-02T18:27:14Z
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@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.