using ExecuteProcess and GetProcessOutput

Discussions about using Windows guests in VirtualBox.
Post Reply
useruser1
Posts: 7
Joined: 20. Jul 2012, 21:29

using ExecuteProcess and GetProcessOutput

Post 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
useruser1
Posts: 7
Joined: 20. Jul 2012, 21:29

Re: using ExecuteProcess and GetProcessOutput

Post 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
useruser1
Posts: 7
Joined: 20. Jul 2012, 21:29

Re: using ExecuteProcess and GetProcessOutput

Post 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
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: using ExecuteProcess and GetProcessOutput

Post by Perryg »

While I can't actually help you , have you downloaded the SDK and look over the examples?
useruser1
Posts: 7
Joined: 20. Jul 2012, 21:29

Re: using ExecuteProcess and GetProcessOutput

Post 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.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: using ExecuteProcess and GetProcessOutput

Post 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.
useruser1
Posts: 7
Joined: 20. Jul 2012, 21:29

Re: using ExecuteProcess and GetProcessOutput

Post by useruser1 »

Thank you! I will do that.
Post Reply