File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,11 @@ public void WaitForExit(bool assertSuccess, TimeSpan? timeSpan = null)
197
197
var exited = Exited . Wait ( timeSpan . Value ) ;
198
198
if ( ! exited )
199
199
{
200
- _output . WriteLine ( $ "The process didn't exit within the allotted time ({ timeSpan . Value . TotalSeconds } seconds).") ;
200
+ lock ( _testOutputLock )
201
+ {
202
+ _output . WriteLine ( $ "The process didn't exit within the allotted time ({ timeSpan . Value . TotalSeconds } seconds).") ;
203
+ }
204
+
201
205
_process . Dispose ( ) ;
202
206
}
203
207
else if ( assertSuccess && _process . ExitCode != 0 )
@@ -227,13 +231,16 @@ public void Dispose()
227
231
_process . KillTree ( ) ;
228
232
}
229
233
230
- _process . CancelOutputRead ( ) ;
231
- _process . CancelErrorRead ( ) ;
234
+ if ( _process != null )
235
+ {
236
+ _process . CancelOutputRead ( ) ;
237
+ _process . CancelErrorRead ( ) ;
232
238
233
- _process . ErrorDataReceived -= OnErrorData ;
234
- _process . OutputDataReceived -= OnOutputData ;
235
- _process . Exited -= OnProcessExited ;
236
- _process . Dispose ( ) ;
239
+ _process . ErrorDataReceived -= OnErrorData ;
240
+ _process . OutputDataReceived -= OnOutputData ;
241
+ _process . Exited -= OnProcessExited ;
242
+ _process . Dispose ( ) ;
243
+ }
237
244
}
238
245
}
239
246
}
You can’t perform that action at this time.
0 commit comments