2017-02-14 11:38:01 -08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Diagnostics;
|
2017-02-14 10:41:58 -08:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli
|
|
|
|
|
{
|
|
|
|
|
internal static class ProcessStartInfoExtensions
|
|
|
|
|
{
|
|
|
|
|
public static int Execute(this ProcessStartInfo startInfo)
|
|
|
|
|
{
|
2017-02-14 11:38:01 -08:00
|
|
|
|
if (startInfo == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(startInfo));
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-14 10:41:58 -08:00
|
|
|
|
var process = new Process
|
|
|
|
|
{
|
|
|
|
|
StartInfo = startInfo
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
process.Start();
|
|
|
|
|
process.WaitForExit();
|
|
|
|
|
|
|
|
|
|
return process.ExitCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|