launch static method

Future<StdioAcpTransport> launch({
  1. required AgentLaunchCommand command,
  2. required ProcessExecutor executor,
  3. Duration terminationTimeout = const Duration(seconds: 5),
})

Implementation

static Future<StdioAcpTransport> launch({
  required AgentLaunchCommand command,
  required ProcessExecutor executor,
  Duration terminationTimeout = const Duration(seconds: 5),
}) async {
  if (command.executable.isEmpty) {
    throw ArgumentError.value(
      command.executable,
      'command.executable',
      'Must not be empty.',
    );
  }
  try {
    final process = await executor.startBidirectional(
      command.executable,
      command.arguments,
      workingDirectory: command.workingDirectory,
      environment: command.environment.isEmpty ? null : command.environment,
    );
    return StdioAcpTransport._(process, terminationTimeout);
  } catch (error) {
    throw AcpTransportException(
      'Failed to launch ACP agent process.',
      cause: error,
    );
  }
}