public Task Create(ShellCommand command)
{
return new Task(() =>
{
CommandOutput commandOutput;
CommandResult output = new CommandResult("", "", "");
try
{
output = this.commandRunner.RunCommand(command);
var resultLog = this.logParser.Parse(output.Result);
var outputLog = this.logParser.Parse(output.Output);
var errorLog = this.logParser.Parse(output.Error);
commandOutput = resultLog;
commandOutput.Results.AddRange(outputLog.Results);
commandOutput.Results.AddRange(errorLog.Results);
}
catch (Exception ex)
{
commandOutput = new CommandOutput("goose", "Failed to run command: " + command.Command, ex.ToString(), CommandOutputItemType.Error);
output = new CommandResult(commandOutput.ToString(), "", "");
}
this.errorReporter.Report(command, output);
this.outputService.Handle(commandOutput);
});
}