Skip to content

Commit

Permalink
Make method name more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Dec 6, 2024
1 parent c526b8d commit e47c492
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -1095,13 +1095,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
}

/**
* Note: masked in some unit tests.
* Throw if expected executable is missing. Add lots of help for author.
*
* @param {string} executableFile
* @param {string} executableDir
* @param {string} subcommandName
*/
_throwForMissingExecutable(executableFile, executableDir, subcommandName) {
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
if (fs.existsSync(executableFile)) return;

const executableDirMessage = executableDir
? `searched for local subcommand relative to directory '${executableDir}'`
: 'no directory for search for local subcommand, use .executableDir() to supply a custom directory';
Expand Down Expand Up @@ -1195,7 +1197,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
proc = childProcess.spawn(executableFile, args, { stdio: 'inherit' });
}
} else {
this._throwForMissingExecutable(
this._checkForMissingExecutable(
executableFile,
executableDir,
subcommand._name,
Expand Down Expand Up @@ -1238,7 +1240,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
proc.on('error', (err) => {
// @ts-ignore: because err.code is an unknown property
if (err.code === 'ENOENT') {
this._throwForMissingExecutable(
this._checkForMissingExecutable(
executableFile,
executableDir,
subcommand._name,
Expand Down

0 comments on commit e47c492

Please sign in to comment.