January 13, 2012 [Issue 7283] New: Add error info to failed shell call | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@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: ------- |
September 17, 2013 [Issue 7283] Add error info to failed shell call | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=7283 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Platform|Other |All Resolution| |WORKSFORME OS/Version|Windows |All --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-17 14:37:17 PDT --- In 2.063.2 this is now: Error: cannot read file blasudfasudfa.d std.exception.ErrnoException@std\process.d(3169): (No error) I think that's good enough, the error is now displayed above. Although I'm not sure whether that's Phobos outputting this or my console. If someone still wants to improve this, reopen the issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation