Browse Source

Flush ProcessUtil buffer (#952)

* Update ProcessUtil.cs

* Update ProcessUtil.cs
darc-main-e5ea0866-8be1-4711-8688-8fd9b7dae18a
Sébastien Ros 6 years ago
committed by GitHub
parent
commit
75ea6203bd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Microsoft.Tye.Core/ProcessUtil.cs

4
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}"));

Loading…
Cancel
Save