我已经尝试了几乎所有我能找到的脚本示例。每个样本都会打开终端一瞬间。即使输入输入后,它也会关闭。这是正常的吗?
var rl = require('readline');
var prompts = rl.createInterface(process.stdin, process.stdout);
prompts.question("How many servings of fruits and vegetables do you eat each day? ", function (servings) {
var message = '';
if (servings < 5) {
message = "Since you're only eating " + servings +
" right now, you might want to start eating " + (5 - servings) + " more.";
} else {
message = "Excellent, your diet is on the right track!";
}
console.log(message);
process.exit();
});
Tools/Options/Node.js Tools/General 中有 2 个选项可以控制这一点:
进程存在异常时等待输入
进程正常存在时等待输入
取自https://nodejstools.codeplex.com/discussions/565665
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)