79636094

Date: 2025-05-23 19:28:49
Score: 1
Natty:
Report link

All of above mentioned solutions are unreliable and should not be accepted.

All of them will fail whenever process requests console input from user.

In this case console message will stuck in standard input stream and and won't get into OutputDataReceived event. This is because input prompt is unflushed string in stream buffer and is not committed as output data until user responded. Asynchronous read of process output using events doesn't allow to read unflushed data in stream buffer. The only way to make reliable process output read is to redirect output to file and monitor file changes instead of reading directly from standard output stream. But this workaround may be not suitable for case when there may be sensitive data in output stream.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Zedarc7