Skip to content

Commit

Permalink
Improve basedir calculation to fix #1274 (#1322)
Browse files Browse the repository at this point in the history
* Improve basedir calculation to fix #1274

* Improve comment
  • Loading branch information
shadowspawn authored Aug 1, 2020
1 parent c7f5f78 commit a71d592
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,11 @@ Read more on https://git.io/JJc0W`);
this._checkForMissingMandatoryOptions();

// Want the entry script as the reference for command name and directory for searching for other files.
const scriptPath = this._scriptPath;
let scriptPath = this._scriptPath;
// Fallback in case not set, due to how Command created or called.
if (!scriptPath && process.mainModule) {
scriptPath = process.mainModule.filename;
}

let baseDir;
try {
Expand Down

0 comments on commit a71d592

Please sign in to comment.