如何在 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()
用指定的code
结束进程.如果省略,则退出使用成功"代码 0
.
process.exit([exitcode])
Ends the process with the specified
code
. If omitted, exit uses the 'success' code0
.
以失败"代码退出:
process.exit(1);
执行节点的shell应该看到退出代码为1
.
The shell that executed node should see the exit code as 1
.
这篇关于如何在 Node.js 中退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文