如何在Node.js中退出 [英] How to exit in Node.js
本文介绍了如何在Node.js中退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用于退出的命令是什么? (即终止Node.js进程)
What is the command that is used to exit? (i.e terminate the Node.js process)
推荐答案
Call the global process
object's exit
method:
process.exit()
process.exit([code])
以指定的
code
结束进程.如果省略,则退出使用成功"代码0
.
process.exit([code])
Ends the process with the specified
code
. If omitted, exit uses the 'success' code0
.
要以失败"代码退出:
process.exit(1);
执行节点的外壳应该将退出代码显示为1
.
The shell that executed node should see the exit code as 1
.
这篇关于如何在Node.js中退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文