File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -164,17 +164,28 @@ static void RunCompiler(string[] args)
164164 CreateNoWindow = true
165165 }
166166 } ;
167+ proc . EnableRaisingEvents = true ;
168+ proc . OutputDataReceived += new DataReceivedEventHandler ( OutputWriter ) ;
169+ proc . ErrorDataReceived += new DataReceivedEventHandler ( OutputWriter ) ;
167170 proc . Start ( ) ;
168- twOut . WriteLine ( proc . StandardOutput . ReadLine ( ) ) ;
169- while ( ( ! proc . StandardOutput . EndOfStream ) || ( ! proc . StandardError . EndOfStream ) ) {
170- if ( ! proc . StandardOutput . EndOfStream )
171- {
172- twOut . WriteLine ( proc . StandardOutput . ReadLine ( ) ) ;
173- }
174- if ( ! proc . StandardError . EndOfStream )
175- {
176- twError . WriteLine ( proc . StandardError . ReadLine ( ) ) ;
177- }
171+ proc . BeginOutputReadLine ( ) ;
172+ proc . BeginErrorReadLine ( ) ;
173+ proc . WaitForExit ( ) ;
174+ }
175+
176+ static void OutputWriter ( object sender , DataReceivedEventArgs args )
177+ {
178+ if ( args . Data != null )
179+ {
180+ twOut . WriteLine ( args . Data ) ;
181+ }
182+ }
183+
184+ static void ErrorWriter ( object sender , DataReceivedEventArgs args )
185+ {
186+ if ( args . Data != null )
187+ {
188+ twError . WriteLine ( args . Data ) ;
178189 }
179190 }
180191}
You can’t perform that action at this time.
0 commit comments