File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/WebJobs.Script/Workers/ProcessManagement Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -179,12 +179,18 @@ private void OnProcessExited(object sender, EventArgs e)
179179 return ;
180180 }
181181
182+ int exit = 0 ;
182183 try
183184 {
184185 ThrowIfExitError ( ) ;
185186
186- Process . WaitForExit ( ) ;
187- if ( Process . ExitCode == WorkerConstants . IntentionalRestartExitCode )
187+ exit = Process . ExitCode ;
188+ if ( Process . ExitCode == WorkerConstants . SuccessExitCode )
189+ {
190+ Process . WaitForExit ( ) ;
191+ Process . Close ( ) ;
192+ }
193+ else if ( Process . ExitCode == WorkerConstants . IntentionalRestartExitCode )
188194 {
189195 HandleWorkerProcessRestart ( ) ;
190196 }
@@ -202,9 +208,8 @@ private void OnProcessExited(object sender, EventArgs e)
202208 }
203209 finally
204210 {
205- _processExit . TrySetResult ( Process . ExitCode ) ;
211+ _processExit . TrySetResult ( exit ) ;
206212 UnregisterFromProcessMonitor ( ) ;
207- Process . Close ( ) ;
208213 }
209214 }
210215
You can’t perform that action at this time.
0 commit comments