Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Run process in this console? What am I missing about process I/O?

Moderators: larsivi kris

Posted: 07/07/07 21:55:37


I'm currently in the process of writing a build script for my project. One of the purposes of this script is to call a certain rebuild command and display rebuild's output.

I'm using the Process class to start the process and then try to access the process's stdout and stderr via LineIterator?, much as is shown in the Tango docs. However, I don't receive any output.

One thing I've thought of is that the things I want to see - DMD's compiler errors - are actually the output of another process started by rebuild. Do I have any chance to get this output? A new console opens for a split second when I start the rebuild process, do I have any possibility to start the process in the existing console instead?

Basically, I just want something like the good old system() function, i.e. run the process, wait until it finishes and dump its output into the console.

Is there some way to accomplish this using the Process interface, instead of relying on the glibc system() function?

Thanks, Sebastian

[url=]Sofu[/url] [url=]The Pursuit of Evilness - 3D Action Game written in D/url [url=]My Coding Blog/url

Author Message

Posted: 07/08/07 20:34:45

if the child process (rebuild, or whatever) is correctly redirecting the output of the grandchild (dmd, or whatever) then you should be able to grab that via the Process class. It is a bit odd that another console flashes up momentarily.

I suggest you create a ticket for this one and assign is to Juan (the author of Process) ... he'd be the most effective at resolving this :)

Posted: 07/12/07 18:44:42

Thanks, I'll do so as soon as I have time to throw together a simple test case.

Posted: 08/07/07 15:41:07

From the description you left it looks as if your child process is starting and exiting with an error. Have you checked the result of the call to Process.wait()? The Process.Result has two member variables called reason and status that will give you some additional information. You could also use the Process.Result.toUtf8() method on the result to get a description of the error you're experiencing. All of this is described in the Process documentation.