[英]Why does the Node.js scripts console close instantly in Windows 8?
I've tried nearly every example for scripts I can find. 我已经尝试了几乎所有可以找到的脚本的例子。 Every sample opens the terminal for a split second.
每个样本都会打开终端一瞬间。 Even this closes as soon as input is entered.
输入输入后,即使这样也会关闭。 Is this normal?
这是正常的吗?
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();
});
There are 2 options that control this in Tools/Options/Node.js Tools/General: 在Tools / Options / Node.js Tools / General中有两个选项可以控制它:
Wait for input when process exists abnormally Wait for input when process exists normally 当进程异常时等待输入当进程正常存在时等待输入
Taken from https://nodejstools.codeplex.com/discussions/565665 取自https://nodejstools.codeplex.com/discussions/565665
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.