Page 1 of 1

using ExecuteProcess and GetProcessOutput

Posted: 23. Jul 2012, 20:46
by useruser1
Does anyone have a good example of using ExecuteProcess to start a process in the guest and using GetProcessOutput to return output from Std out in C#.
I am trying to do this by first calling ExecuteProcess and then GetProcessOutput. I am also setting the ExecuteProcessFlag_WaitForStdOut. However, once the process starts, I am not seeing any output to the console, and not getting any output returned from GetProcessOutput either. I can post also if needed.

Thanks

Re: using ExecuteProcess and GetProcessOutput

Posted: 23. Jul 2012, 23:29
by useruser1
One more thing I noticed that might help....

When using the ExecuteProcessFlag_WaitForStdOut in the ExecuteProcess call, the process which gets executed never exits.
When I use the ExecuteProcessFlag_None, a command window quickly pops up and exits. This is basically a test program that just writes output to the console, so maybe this is what is supposed to happen.
When I run the program manually inside the vm, I get the results I expect. Output is written to the console and then eventually exits.

I want to be able to exit the process once the std out is written. I also want to be able to capture the output with GetProcessOutput.

Thanks

Re: using ExecuteProcess and GetProcessOutput

Posted: 24. Jul 2012, 20:02
by useruser1
OK after trying a few things I narrowed down the problem to the fact that I cannot see anything in StdOut or enter anything via StdIn when my process begins to execute in the vm via ExecuteProcess?

Anyone have any idea how I can at least see what my process outputs on the command window and how I can manually enter input inside vm once the process is started from the host?

Thanks

Re: using ExecuteProcess and GetProcessOutput

Posted: 24. Jul 2012, 20:11
by Perryg
While I can't actually help you , have you downloaded the SDK and look over the examples?

Re: using ExecuteProcess and GetProcessOutput

Posted: 24. Jul 2012, 20:30
by useruser1
Yup I have downloaded the SDK. I looked at the VB and C++ examples that were provided. None of them used ExecuteProcess or GetProcessOutput. Even though my project is in C#, I still figured a good example in whatever language will help.
I have searched all over these forums and also browsed the web. I have not seen too much. There was one post where someone had a similar problem.
I tried what he did, but still no luck. :( It had to do with setting the ExecuteProcessFlag_WaitForStdOut.

Re: using ExecuteProcess and GetProcessOutput

Posted: 24. Jul 2012, 20:32
by Perryg
You may need to ask the DEVs on the mailing list if what you are wanting to do is even possible with their API.

Re: using ExecuteProcess and GetProcessOutput

Posted: 24. Jul 2012, 20:39
by useruser1
Thank you! I will do that.