in build/Shell.cs [63:121]
public int Run(Action<string> outputCallback = null, Action<string> errorCallback = null)
{
var processInfo = new ProcessStartInfo
{
FileName = _exeName,
Arguments = _arguments,
CreateNoWindow = !_visibleProcess,
UseShellExecute = _shareConsole,
RedirectStandardError = _streamOutput,
RedirectStandardInput = _streamOutput,
RedirectStandardOutput = _streamOutput,
WorkingDirectory = Directory.GetCurrentDirectory()
};
Process process = null;
try
{
process = Process.Start(processInfo);
}
catch (Win32Exception ex)
{
if (ex.Message == "The system cannot find the file specified")
{
throw new FileNotFoundException(ex.Message, ex);
}
throw ex;
}
if (_streamOutput)
{
if (outputCallback != null)
{
process.OutputDataReceived += (s, e) =>
{
if (e.Data != null)
{
outputCallback(e.Data);
}
};
process.BeginOutputReadLine();
}
if (errorCallback != null)
{
process.ErrorDataReceived += (s, e) =>
{
if (!string.IsNullOrWhiteSpace(e.Data))
{
errorCallback(e.Data);
}
};
process.BeginErrorReadLine();
}
process.EnableRaisingEvents = true;
}
process.WaitForExit();
return process.ExitCode;
}