From 79dd9690d11313793b0f8071c8c7a8eddf52b51b Mon Sep 17 00:00:00 2001 From: Pratik Sanglikar Date: Tue, 27 Jul 2021 15:58:11 -0700 Subject: [PATCH] Add supporting comments --- src/Microsoft.Tye.Core/ProcessUtil.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.Tye.Core/ProcessUtil.cs b/src/Microsoft.Tye.Core/ProcessUtil.cs index d0c8ad1b..c89c4943 100644 --- a/src/Microsoft.Tye.Core/ProcessUtil.cs +++ b/src/Microsoft.Tye.Core/ProcessUtil.cs @@ -125,6 +125,7 @@ namespace Microsoft.Tye // Since these are expected to be long running processes and we're typically not concerned with capturing all of its output // i.e. it's probably ok for some output to be lost on shutdown, since Tye is shutting down anyway, // we call Process.WaitForProcessExit(ProcessExitTimeoutMs). + // Also, since this is a process.Exited event, process.ExitCode is valid even if WaitForExit() times out. process.WaitForExit(ProcessExitTimeoutMs); } @@ -134,6 +135,7 @@ namespace Microsoft.Tye } else { + // Since the process has exited, no additional data will be written to either output buffer or error buffer, it's thread-safe to call ToString() on both outputBuilder and errorBuilder. processLifetimeTask.TrySetResult(new ProcessResult(outputBuilder.ToString(), errorBuilder.ToString(), process.ExitCode)); } };