September 09, 2011 Re: How would I retrieve the stdout error message of a system/shell command? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On Thu, 08 Sep 2011 16:33:49 +0100, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote: > E.g.: > > import std.process; > > void main() > { > auto res = shell("dmd bla.d"); > } > > where bla.d doesn't exist. This will throw an exception, but even if I > caught the exception I will still loose the error message. Is there > any way I could grab the error message? In this case it would be: > > "std.exception.ErrnoException@std\process.d(356): (No error)" > > Okay that's a pretty useless error as it is, but other errors might be > more informative and I'd like to grab them. I have, somewhere, a windows (or perhaps cross platform?) pipestream/subprocess implementation. But, this was for an older version of D/phobos and may not now compile. I'll have a look for it tonight, or later today (as, hopefully we'll have internet at home this afternoon). -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
Copyright © 1999-2021 by the D Language Foundation