Skip to content

Commit d141cb4

Browse files
committed
Only close process on success
1 parent ba560ce commit d141cb4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/WebJobs.Script/Workers/ProcessManagement/WorkerProcess.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,12 @@ private void OnProcessExited(object sender, EventArgs e)
183183
{
184184
ThrowIfExitError();
185185

186-
Process.WaitForExit();
187-
if (Process.ExitCode == WorkerConstants.IntentionalRestartExitCode)
186+
if (Process.ExitCode == WorkerConstants.SuccessExitCode)
187+
{
188+
Process.WaitForExit();
189+
Process.Close();
190+
}
191+
else if (Process.ExitCode == WorkerConstants.IntentionalRestartExitCode)
188192
{
189193
HandleWorkerProcessRestart();
190194
}
@@ -204,7 +208,6 @@ private void OnProcessExited(object sender, EventArgs e)
204208
{
205209
_processExit.TrySetResult(Process.ExitCode);
206210
UnregisterFromProcessMonitor();
207-
Process.Close();
208211
}
209212
}
210213

0 commit comments

Comments
 (0)