Comment

Comment by timrobinson

It won't hang as long as you're redirecting only standard output. If you want to read both StandardOutput and StandardError, you need to do it from separate threads: either with explicit BeginInvoke/EndInvoke calls as in Kudu, or more simply, by listening on the OutputDataReceived/ErrorDataReceived events then calling BeginOutputReadLine/BeginErrorReadLine.

(The reason for this is that the two streams are redirected to separate pipes, each of which has its own fixed-size buffer. If you forget to read from one pipe while you read from the other, its buffer fills up, and the writer - the program being executed - blocks. With standard error redirection turned off, the program writes directly to the console, which is safe.)

parent timrobinson 14 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton