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

           Summary: Add error info to failed shell call
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2012-01-12 
16:40:32 PST ---
std.process.shell implements the system call with errnoEnforce, returning no
useful information on what went wrong. Here's what a typical call produces:

import std.exception;
import std.process;
import std.string;

void main()
{
    string cmd = "dmd -c blasudfasudfa.d";
    shell(cmd);
}

std.exception.ErrnoException@std\process.d(364):  (No error)
----------------
D:\dev\code\d_code\test.d(8): D main
----------------

I hate that confusing "No error" as well. I suggest we reimplement shell() so
it does the following:

import std.exception;
import std.process;
import std.string;

void main()
{
    string cmd = "dmd -c blasudfasudfa.d";
    string filename = "blabiudasf";
    auto result = system(cmd ~ "> " ~ filename);
    enforce(result == 0, format(`system("%s") returned %s`, cmd, result));
}

Result:
object.Exception@test.d(12): system("dmd -c blasudfasudfa.d") returned 1

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to