Searches the system for the path to a program named binaryName.
If the program can't be found, null is returned.
@parambinaryName — The program to search for@paramoptions — Options which affect how the search is performed@paramoptions.searchPaths — A list of folders where programs may be found. Defaults toenv.PATH?.split(Path.OS_ENV_VAR_SEPARATOR) || [].@paramoptions.suffixes — A list of filename extension suffixes to include in the search, ie [".exe"]. Defaults toPath.OS_PROGRAM_EXTENSIONS.@paramoptions.trace — A logging function that will be called at various times during the execution ofwhich. Defaults to logger.trace.
declare function which(binaryName: string, options?: WhichOptions): Path | null;declare type WhichOptions = {
searchPaths?: Array<Path | string>;
suffixes?: Array<string>;
logging?: {
trace?: (...args: Array<any>) => void;
};
};A list of folders where programs may be found. Defaults to
env.PATH?.split(Path.OS_ENV_VAR_SEPARATOR) || [].
searchPaths?: Array<Path | string>;A list of filename extension suffixes to include in the search, ie
[".exe"]. Defaults to Path.OS_PROGRAM_EXTENSIONS.
suffixes?: Array<string>;Options which control logging.
logging?: {
trace?: (...args: Array<any>) => void;
};If provided, this logging function will be called multiple times as
which runs, to help you understand what's going on and/or troubleshoot
things. In most cases, it makes sense to use a function from console
here, like so:
which("bash", {
logging: { trace: console.log },
});Defaults to the current value of logger.trace. logger.trace
defaults to a no-op function.
trace?: (...args: Array<any>) => void;