wait for log drain
This commit is contained in:
@@ -33,13 +33,14 @@ public class RunService
|
|||||||
RedirectStandardError = true
|
RedirectStandardError = true
|
||||||
};
|
};
|
||||||
|
|
||||||
await using var process = new AsyncReadProcess.Process2()
|
var process = new AsyncReadProcess.Process2
|
||||||
{
|
{
|
||||||
StartInfo = processStartInfo
|
StartInfo = processStartInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
process.Start();
|
process.Start();
|
||||||
|
|
||||||
|
var logsDrained = new TaskCompletionSource();
|
||||||
_ = Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await foreach(var log in process.CombinedOutputChannel.Reader.ReadAllAsync())
|
await foreach(var log in process.CombinedOutputChannel.Reader.ReadAllAsync())
|
||||||
@@ -47,6 +48,7 @@ public class RunService
|
|||||||
var logString = System.Text.Encoding.UTF8.GetString(log, 0, log.Length);
|
var logString = System.Text.Encoding.UTF8.GetString(log, 0, log.Length);
|
||||||
Console.Write(logString);
|
Console.Write(logString);
|
||||||
}
|
}
|
||||||
|
logsDrained.TrySetResult();
|
||||||
});
|
});
|
||||||
|
|
||||||
project.Running = true;
|
project.Running = true;
|
||||||
@@ -57,6 +59,8 @@ public class RunService
|
|||||||
process.End();
|
process.End();
|
||||||
await process.WaitForExitAsync();
|
await process.WaitForExitAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await logsDrained.Task;
|
||||||
project.Running = false;
|
project.Running = false;
|
||||||
GlobalEvents.InvokeProjectsRunningChanged();
|
GlobalEvents.InvokeProjectsRunningChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- If any Microsoft.Build.dll ends up in the output, it will be prioritised for loading by MSBuild Nodes -->
|
<!-- If any Microsoft.Build.dll ends up in the output, it will be prioritised for loading by MSBuild Nodes -->
|
||||||
<PackageReference Include="Ardalis.GuardClauses" Version="5.0.0" />
|
<PackageReference Include="Ardalis.GuardClauses" Version="5.0.0" />
|
||||||
<PackageReference Include="AsyncReadProcess" Version="1.0.0-preview6" />
|
<PackageReference Include="AsyncReadProcess" Version="1.0.0-preview7" />
|
||||||
<PackageReference Include="Microsoft.Build" Version="17.14.8" ExcludeAssets="runtime" />
|
<PackageReference Include="Microsoft.Build" Version="17.14.8" ExcludeAssets="runtime" />
|
||||||
<PackageReference Include="Microsoft.Build.Framework" Version="17.14.8" ExcludeAssets="runtime" />
|
<PackageReference Include="Microsoft.Build.Framework" Version="17.14.8" ExcludeAssets="runtime" />
|
||||||
<PackageReference Include="Microsoft.Build.Locator" Version="1.9.1" />
|
<PackageReference Include="Microsoft.Build.Locator" Version="1.9.1" />
|
||||||
|
|||||||
Reference in New Issue
Block a user