resolveBinaryPath method

  1. @override
Future<String> resolveBinaryPath(
  1. String binaryCommand
)
override

Resolves the binary path for a given command. See resolveBinaryPathCached.

  • binaryCommand: The command to resolve the binary path for.

Returns a Future that completes with the resolved binary path as a String.

Implementation

@override
Future<String> resolveBinaryPath(String binaryCommand) async {
  try {
    final result = await Process.run('which', [binaryCommand]);

    if (result.exitCode == 0) {
      var stdout = result.stdout as String;
      return stdout.trim();
    } else {
      throw Exception('Command not found: $binaryCommand');
    }
  } catch (e) {
    throw Exception('Failed to resolve binary path: $e');
  }
}