www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - running an external .exe

reply Funog <funog ifrance.com> writes:
Is it possible to run an external .exe and have access to its standard
input/output? Apparently std.process does not allow this.
Feb 16 2010
next sibling parent BCS <none anon.com> writes:
Hello Funog,

 Is it possible to run an external .exe and have access to its standard
 input/output? Apparently std.process does not allow this.
 

I think there is a pstream or PipeStream somewhere but I don't remember where I saw that. -- ... <IXOYE><
Feb 16 2010
prev sibling next sibling parent Jesse Phillips <jessekphillips+D gmail.com> writes:
Funog wrote:

 Is it possible to run an external .exe and have access to its standard
input/output? Apparently std.process does not allow this.

In D2 std.process has an undocumented function: string shell(string cmd) which will give you the output. But might be undocumented because it doesn't work in Windows. I don't know of anything to manipulate input.
Feb 16 2010
prev sibling next sibling parent =?ISO-8859-1?Q?Pelle_M=E5nsson?= <pelle.mansson gmail.com> writes:
On 02/16/2010 08:09 PM, Funog wrote:
 Is it possible to run an external .exe and have access to its standard
input/output? Apparently std.process does not allow this.

You'll want to choose either the input or the output stream, otherwise you might get eaten by a deadlock.
Feb 17 2010
prev sibling parent daoryn <asdf sfa.we> writes:
Funog Wrote:

 Is it possible to run an external .exe and have access to its standard
input/output? Apparently std.process does not allow this.
 

You can try loading the .exe into memory as a library (dll) and passing the .exe's entry point (main) to a thread (core.thread.Thread). Just a rant.
Feb 17 2010