Thread overview
[Issue 9444] New: shell doesn't throw on error.
Feb 04, 2013
simendsjo
[Issue 9444] Regression (2.059): shell doesn't throw on error.
Feb 15, 2013
Walter Bright
Feb 15, 2013
Andrej Mitrovic
February 03, 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@puremagic.com
        ReportedBy: thelastmammoth@gmail.com


--- Comment #0 from thelastmammoth@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@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: -------
February 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9444


simendsjo <simendsjo@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simendsjo@gmail.com


--- Comment #1 from simendsjo <simendsjo@gmail.com> 2013-02-04 02:50:12 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9444


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2013-02-14 19:07:42 PST ---
https://github.com/D-Programming-Language/phobos/pull/1135

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9444



--- Comment #3 from github-bugzilla@puremagic.com 2013-02-14 19:08:15 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9444



--- Comment #4 from github-bugzilla@puremagic.com 2013-02-14 19:10:16 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9444


Andrej Mitrovic <andrej.mitrovich@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: -------