whichSync function

String? whichSync(
  1. String command, {
  2. Map<String, String>? environment,
  3. bool includeParentEnvironment = true,
})

Find the command according to the paths or env variables (PATH)

Implementation

String? whichSync(
  String command, {
  Map<String, String>? environment,
  bool includeParentEnvironment = true,
}) {
  // only valid for single commands
  if (basename(command) != command) {
    return null;
  }
  // Merge system environment
  var shellEnvironment = ShellEnvironment.full(
    environment: environment,
    includeParentEnvironment: includeParentEnvironment,
  );
  return shellEnvironment.whichSync(command);
}