commandExists function

Future<bool> commandExists(
  1. String command
)

Check if a command is available on PATH.

Implementation

Future<bool> commandExists(String command) async {
  try {
    final result = await Process.run(Platform.isWindows ? 'where' : 'which', [
      command,
    ]);
    return result.exitCode == 0;
  } catch (_) {
    return false;
  }
}