I can easily start a process with it's STD I/O redirected but how can I redirect the STD I/O of an existing process.
Process process = Process.GetProcessById(_RunningApplication.AttachProcessId);
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
string text = process.StandardOutput.ReadToEnd(); //This line blows up.
Exception:
StandardOut has not been redirected or the process hasn't started yet.
Side note: If you know how to do this in C/C++ I'd be happy to re-tag and accept. I just need to know if it's even possible.
It doesn't look like it's possible in C#. Looking at possibility in C++.
EDIT: You can use named pipes in C# and that may be a better way to get IPC if that is what you are trying to accomplish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With