Skip to content

Commit 331d103

Browse files
soimybcoe
authored andcommitted
fix: Add dirname sanity check on findUp (#1036)
1 parent 0942a15 commit 331d103

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎yargs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ function Yargs (processArgs, cwd, parentRequire) {
502502
let obj = {}
503503
try {
504504
const pkgJsonPath = findUp.sync('package.json', {
505-
cwd: path || require('require-main-filename')(parentRequire || require),
505+
cwd: path || require('path').dirname(require('require-main-filename')(parentRequire || require)),
506506
normalize: false
507507
})
508508
obj = JSON.parse(fs.readFileSync(pkgJsonPath))

0 commit comments

Comments
 (0)