[Issue 7283] New: Add error info to failed shell call
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 12 16:40:35 PST 2012
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: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at 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 at 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 at 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: -------
More information about the Digitalmars-d-bugs
mailing list