On Thu, 21 Jul 2011 09:33:34 -0400, Vladimir Panteleev <[email protected]> wrote:

On Thu, 21 Jul 2011 16:19:12 +0300, Maraco <[email protected]> wrote:

Hello.

I have a specific problem. I need to redirect console output from a
console program to dfl textbox but i cant find function to do it.
std.process.system only shows exiting code. I think
std.process.shell should do it but it is crashing whole program.

If You don't know what im asking for there's code how i've done it
in C#:

*CODE BEGINS
Process p = new Process();
            p.StartInfo.FileName = "shutdown";
            p.StartInfo.Arguments = " /?";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.CreateNoWindow = true;
            p.Start();

            string output = p.StandardOutput.ReadToEnd();

            textBox3.Text = output;
*CODE ENDS

Can you provide me an idea what im doing wrong or alternative to
popen in D langauge?

Regards.

This functionality is currently not implemented in D's standard library.
Lars Kyllingstad implemented this in his version of std.process, but only supporting the POSIX API.
For Windows, you'll need to do it manually, in the same way as in C:
http://msdn.microsoft.com/en-us/library/ms682499(v=vs.85).aspx

In fact, my windows changes are merged into Lars' branch (https://github.com/kyllingstad/phobos/tree/new-std-process)

*BUT* (and this is a big but), dmc's runtime incorrectly handles pipes with C's stdio (i.e. FILE *). Since everything in D right now is FILE * based, it means you can't use pipes at all.

However, I have submitted a patch for DMC's runtime to Walter. Hopefully it will be approved in the near future, and then we can work on merging the new std.process into phobos.

-Steve

Reply via email to