Skip to content

Commit 7a1d8da

Browse files
committed
Fix: vebose option should error if no number is given
1 parent 676792a commit 7a1d8da

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/util.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@ async function e_call(argv, script, ...args) {
212212
return;
213213
}
214214

215+
if (argv.verbose !== undefined &&
216+
// this must exclude NaN -- yargs default value for numeric type
217+
!(argv.verbose >= 0 && argv.verbose <= 5)) {
218+
console.warn("invalid value for --verbose option: must be a number between 0 and 5");
219+
process.exit(1);
220+
return;
221+
}
222+
215223
return new Promise(resolve => {
216224
let _path = el_script(script);
217225

0 commit comments

Comments
 (0)