diff --git a/src/Microsoft.Tye.Core/ProcessUtil.cs b/src/Microsoft.Tye.Core/ProcessUtil.cs index 2fae79d7..ef77ec44 100644 --- a/src/Microsoft.Tye.Core/ProcessUtil.cs +++ b/src/Microsoft.Tye.Core/ProcessUtil.cs @@ -103,6 +103,10 @@ namespace Microsoft.Tye process.Exited += (_, e) => { + // Even though the Exited event has been raised, WaitForExit() must still be called to ensure the output buffers + // have been flushed before the process is considered completely done. + process.WaitForExit(); + if (throwOnError && process.ExitCode != 0) { processLifetimeTask.TrySetException(new InvalidOperationException($"Command {filename} {arguments} returned exit code {process.ExitCode}"));