c#: RedirectStandardOutput prevents exit exception?
- by user1743977
All I want is to redirect standard output of a process to a file. Sounds easy, but everything I tried doesn't work:
1) putting a dos-style redirection in the list of arguments (e.g. "param1 param2 output.txt") doesn't work,
2) using RedirectStandardOutput = true works, BUT, apparently the process does not through an exception when it exists. So the handler defined via process.Exited += ... doesn't catch anything. To be clear, once I remove the 'RedirectStandardOutput = true ' statement, it DOES catch an exception.
What am I doing wrong ?
Thanks,
Ofer