How would I retrieve the stdout error message of a system/shell command?
Regan Heath
regan at netmail.co.nz
Fri Sep 9 04:03:06 PDT 2011
On Thu, 08 Sep 2011 16:33:49 +0100, Andrej Mitrovic
<andrej.mitrovich at 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 at 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/
More information about the Digitalmars-d-learn
mailing list