0

这有什么问题?

const Vantage = require('vantage')

const v = Vantage()
    .delimiter('$test')
    .listen(9000)
    .show()

const close = () => {
    v.exec('exit', () => {
        console.log('DONE')
    })
 }  
setTimeout(close, 1000)

错误:

UI Prompt 已在提示中间时调用。在 Object.prompt (/Users/giggioz/Spaghetti/keeper/keeper-giochipiu-delegates/node_modules/vorpal/lib/ui.js:131:13) 在 Vorpal.vorpal.prompt (/Users/giggioz/Spaghetti/keeper/ keeper-giochipiu-delegates/node_modules/vorpal/lib/vorpal.js:450:8) 在 Vorpal.vorpal.exit (/Users/giggioz/Spaghetti/keeper/keeper-giochipiu-delegates/node_modules/vorpal/lib/vorpal. js:1160:12) 在会议上。(/Users/giggioz/Spaghetti/keeper/keeper-giochipiu-delegates/node_modules/vorpal/lib/vorpal-commons.js:49:19) 在 Vorpal.vorpal._exec (/Users/giggioz/Spaghetti/keeper/keeper- giochipiu-delegates/node_modules/vorpal/lib/vorpal.js:846:18) 在 Vorpal.vorpal._execQueueItem (/Users/giggioz/Spaghetti/keeper/keeper-giochipiu-delegates/node_modules/vorpal/lib/vorpal.js: 594:10) 在 Vorpal.vorpal。

4

1 回答 1

0

解决方案:

const Vantage = require('vantage')

Vantage()
    .delimiter('$test')
    .listen(9000)
    .show()

const close = () => {
    process.exit(1)
}
setTimeout(close, 1000)
于 2018-10-11T17:05:07.580 回答