public override ProcessResult Size(IConsole console, IStandardProject project, LinkResult linkResult)
{
var result = new ProcessResult();
var startInfo = new ProcessStartInfo();
startInfo.FileName = Path.Combine(BaseDirectory, "arm-none-eabi-size" + Platform.ExecutableExtension);
if (!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;
}