コード例 #1
0
        public void Report(ShellCommand command, CommandResult result)
        {
            this.errorTaskHandler.Remove(command);

            var resultTasks = this.BuildErrorTask(command, result.Result);
            this.errorTaskHandler.Add(resultTasks);
        }
コード例 #2
0
        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);
                });
        }
コード例 #3
0
        public void Should_parse_command_result_when_creating_error_task()
        {
            var result = new CommandResult("build log", null, null);

            this.errorReporter.Report(A.Fake<ShellCommand>(), result);

            A.CallTo(() => this.logParser.Parse("build log")).MustHaveHappened();
        }