public override ProcessResult Size(IConsole console, IStandardProject project, LinkResult linkResult)
{
var result = new ProcessResult();
var startInfo = new ProcessStartInfo();
startInfo.FileName = Path.Combine(BaseDirectory, "GCC\\bin", "arm-none-eabi-size.exe");
if (Path.IsPathRooted(startInfo.FileName) && !System.IO.File.Exists(startInfo.FileName))
{
console.WriteLine("Unable to find tool (" + startInfo.FileName + ") check project compiler settings.");
result.ExitCode = -1;
return result;
}
startInfo.Arguments = string.Format("{0}", linkResult.Executable);
// Hide console window
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardInput = true;
startInfo.CreateNoWindow = true;
using (var process = Process.Start(startInfo))
{
process.OutputDataReceived += (sender, e) => { console.WriteLine(e.Data); };
process.ErrorDataReceived += (sender, e) => { console.WriteLine(e.Data); };
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
result.ExitCode = process.ExitCode;
}
return result;
}