Make all command execution synchronous

- This fixes a bunch of weird races I was seeing building
larger solutions.
This commit is contained in:
David Fowler 2015-10-21 03:11:27 -07:00
parent c1e2d152e3
commit 5872aa0f0c
5 changed files with 29 additions and 30 deletions

View file

@ -113,8 +113,7 @@ namespace Microsoft.DotNet.Tools.Compiler
var compileResult = Command.Create("dotnet-compile", $"--framework {projectDependency.Framework} --configuration {configuration} --no-project-dependencies {projectDependency.Project.ProjectDirectory}")
.ForwardStdOut()
.ForwardStdErr()
.RunAsync()
.Result;
.Execute();
if (compileResult.ExitCode != 0)
{
@ -198,7 +197,7 @@ namespace Microsoft.DotNet.Tools.Compiler
File.WriteAllLines(rsp, compilerArgs);
var result = Command.Create($"dotnet-compile-{compiler}", $"\"{rsp}\"")
.OnErrorLine(line =>
.OnErrorLine(line =>
{
var diagnostic = ParseDiagnostic(context.ProjectDirectory, line);
if (diagnostic != null)
@ -223,9 +222,7 @@ namespace Microsoft.DotNet.Tools.Compiler
Console.Out.WriteLine(line);
}
})
.RunAsync()
.GetAwaiter()
.GetResult();
.Execute();
foreach (var diag in diagnostics)
{
@ -300,9 +297,7 @@ namespace Microsoft.DotNet.Tools.Compiler
var result = Command.Create("resgen", $"{fileName} {resourcesFile}")
.ForwardStdErr()
.ForwardStdOut()
.RunAsync()
.GetAwaiter()
.GetResult();
.Execute();
if (result.ExitCode != 0)
{