Invoke intrinsic commands directly instead of creating a process.

This commit is contained in:
Austin Wise 2016-02-03 12:04:09 -08:00
parent a65054d947
commit 413cf152ae
6 changed files with 28 additions and 55 deletions

View file

@ -90,7 +90,7 @@ namespace Microsoft.DotNet.Tools.Run
var tempDir = Path.Combine(_context.ProjectDirectory, "bin", ".dotnetrun", Guid.NewGuid().ToString("N"));
// Compile to that directory
var result = Command.CreateDotNet($"build", new []
var result = Build.BuildCommand.Run(new[]
{
$"--output",
$"{tempDir}",
@ -101,14 +101,11 @@ namespace Microsoft.DotNet.Tools.Run
$"--configuration",
$"{Configuration}",
$"{_context.ProjectFile.ProjectDirectory}"
})
.ForwardStdOut(onlyIfVerbose: true)
.ForwardStdErr()
.Execute();
});
if (result.ExitCode != 0)
if (result != 0)
{
return result.ExitCode;
return result;
}
// Now launch the output and give it the results
@ -149,7 +146,8 @@ namespace Microsoft.DotNet.Tools.Run
.ForwardStdOut()
.ForwardStdErr()
.EnvironmentVariable("DOTNET_HOME", dotnetHome)
.Execute();
.Execute()
.ExitCode;
// Clean up
if (!PreserveTemporary)
@ -157,7 +155,7 @@ namespace Microsoft.DotNet.Tools.Run
Directory.Delete(tempDir, recursive: true);
}
return result.ExitCode;
return result;
}
private static int RunInteractive(string scriptName)