fromCommand static method

StepError? fromCommand(
  1. (CommandResult?, CommandError?) outcome
)

Converts the outcome of a command to the error of the step, if the command has failed

Implementation

static StepError? fromCommand((CommandResult?, CommandError?) outcome) {
  if (outcome.$2 != null) {
    return StepError(outcome.$2!.message);
  }
  if (outcome.$1 != null && outcome.$1!.exitCode != 0) {
    return StepError("exited with code ${outcome.$1!.exitCode}");
  }
  return null;
}