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.
Comment #1 by simendsjo — 2013-02-04T02:50:12Z
It should be noted that std.process will be deprecated (hopefully) soon. Here's the replacement: https://github.com/D-Programming-Language/phobos/pull/1100
Comment #2 by bugzilla — 2013-02-14T19:07:42Z
Comment #3 by github-bugzilla — 2013-02-14T19:08:15Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/2844f0ef3bb6bba26bdbc225eb6cf62f2c544dd1 Fixes Issue 9444 - Exception must be thrown on Posix when shell() call fails. https://github.com/D-Programming-Language/phobos/commit/0bfa9f27d4322531f1ce02cc9f167fff0100323d Merge pull request #1135 from AndrejMitrovic/Fix9444 Issue 9444 - Exception must be thrown on Posix when shell() call fails
Comment #4 by github-bugzilla — 2013-02-14T19:10:16Z
Commit pushed to staging at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/5fb6c7a1d33f9d7d7c70ef90fcb257ce652939f7 Merge pull request #1135 from AndrejMitrovic/Fix9444 Issue 9444 - Exception must be thrown on Posix when shell() call fails