initializeAsync method

  1. @override
Future<void> initializeAsync({
  1. CancellationToken? cancellationToken,
})
override

Eagerly initialize the backend. Idempotent; subsequent calls are no-ops once the executor is started.

Implementation

@override
Future<void> initializeAsync({CancellationToken? cancellationToken}) async {
  if (_options.mode == ShellMode.persistent) {
    await _ensureContainerRunning();
    _session = ShellSession(
      binary: _options.dockerBinary,
      persistentArgv: buildExecArgv(
        _options.dockerBinary,
        containerName,
      ).sublist(1), // Remove binary — Process.start takes it separately.
      family: ShellFamily.posix,
      workingDirectory: null,
      environment: null,
    );
    await _session!.initialize();
  }
}