isToolOnPath function
Returns true if tool can be found on PATH.
Uses where on Windows and which everywhere else, since Windows does
not ship a which binary.
Implementation
bool isToolOnPath(String tool) {
try {
final result = Process.runSync(Platform.isWindows ? 'where' : 'which', [tool]);
return result.exitCode == 0;
} catch (_) {
return false;
}
}