Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed Jul 2, 2019
1 parent 71ad23f commit 19bd8c0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ const assertPatternsInput = patterns => {
};

const checkCwdOption = options => {
if (options && options.cwd && fs.existsSync(options.cwd) && !fs.statSync(options.cwd).isDirectory()) {
throw new Error('The `cwd` option must be a path to a directory');
if (options && options.cwd) {
let stat;
try {
stat = fs.statSync(options.cwd);
} catch (_) {
return;
}

if (!stat.isDirectory()) {
throw new Error('The `cwd` option must be a path to a directory');
}
}
};

Expand Down

0 comments on commit 19bd8c0

Please sign in to comment.