www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9444] New: shell doesn't throw on error.

reply d-bugmail puremagic.com writes:
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



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: -------
Feb 02 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9444


simendsjo <simendsjo gmail.com> changed:

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



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


Walter Bright <bugzilla digitalmars.com> changed:

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



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




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


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




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

https://github.com/D-Programming-Language/phobos/commit/5fb6c7a1d33f9d7d7c70ef90fcb257ce652939f7


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: -------
Feb 14 2013
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Feb 14 2013