Closed disarticulate closed 5 years ago
Try wrapping your arguments in quotes.
Ran into this same error today, it does not appear to be a quoting issue. Simplified the sample above as follows:
const vorpal = require('vorpal')()
try {
vorpal.execSync('ok')
console.log('PASS: ok worked')
} catch (e) {
console.log('FAIL: ok failed', e.stack)
}
try {
vorpal.execSync('undefine')
console.log('PASS: undefine worked')
} catch (e) {
console.log('FAIL: undefine failed', e.stack)
}
I would expect that would output PASS twice in a row. But it actually does PASS for the first and FAIL for the second:
> temp@1.0.0 start /Users/mdouglass/kixeye/km/server/temp
> node index.js
Invalid Command. Showing Help:
Commands:
help [command...] Provides help for a given command.
exit Exits application.
PASS: ok worked
FAIL: undefine failed Error: vorpal._exec was called with an undefined command.
at Vorpal.vorpal._exec (/Users/mdouglass/kixeye/km/server/temp/node_modules/vorpal/dist/vorpal.js:787:11)
at Vorpal.vorpal._execQueueItem (/Users/mdouglass/kixeye/km/server/temp/node_modules/vorpal/dist/vorpal.js:751:17)
at Vorpal.vorpal.execSync (/Users/mdouglass/kixeye/km/server/temp/node_modules/vorpal/dist/vorpal.js:719:15)
at Object.<anonymous> (/Users/mdouglass/kixeye/km/server/temp/index.js:13:10)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
Tested with Node v10.3.0, npm v6.1.0
Error is being thrown at https://github.com/dthree/vorpal/blob/master/dist/vorpal.js#L834
"vorpal": "^1.12.0"
Not sure where the parsing gets confused.