Skip to content
Myr

Replace process.mainModule with require.main (#1448)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by John Gee · committed by GitHub · parent afcecd6 · Browse files · 1 file+4 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−8 removed

  • other:+4 added−8 removed

1 file+4 added−8 removed

modified:index.js+4 added-8 removed
1268 unmodified lines
1269 break;1270 default:1271 throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);1272 }1273 // @ts-ignore: unknown property1274 if (!this._scriptPath && process.mainModule) {1275 // @ts-ignore: unknown property1276 this._scriptPath = process.mainModule.filename;1273 if (!this._scriptPath && require.main) {1274 this._scriptPath = require.main.filename;1275 }12761277 // Guess name, used in usage in help.1278 this._name = this._name || (this._scriptPath && path.basename(this._scriptPath, path.extname(this._scriptPath)));
45 unmodified lines
13241325 // Want the entry script as the reference for command name and directory for searching for other files.1326 let scriptPath = this._scriptPath;1327 // Fallback in case not set, due to how Command created or called.1330 // @ts-ignore: unknown property1331 if (!scriptPath && process.mainModule) {1332 // @ts-ignore: unknown property1333 scriptPath = process.mainModule.filename;1328 if (!scriptPath && require.main) {1329 scriptPath = require.main.filename;1330 }13311332 let baseDir;1333 try {
863 unmodified lines