run method

  1. @override
Future<Result<TerminalOutput>> run(
  1. TerminalCommand command
)
override

Runs command, returning launch failures as Result failures.

A non-zero child exit code is a successfully captured output, not a transport failure — the caller decides whether that status matters.

Implementation

@override
Future<Result<TerminalOutput>> run(TerminalCommand command) async {
  commands.add(command);
  return _results.isEmpty
      ? portFailure<TerminalOutput>(
          port: PortName.terminal,
          code: PortErrorCode.unexpectedCall,
          operation: 'run',
          message: 'Terminal result not scripted',
          details: <String, Object?>{'executable': command.executable},
        )
      : _results.removeFirst();
}