Lotus@
2011-03-10 21:30
采纳率: 100%
浏览 633
已采纳

如何在 Node.js 中退出

What is the command that is used to exit? (i.e terminate the Node.js process)

转载于:https://stackoverflow.com/questions/5266152/how-to-exit-in-node-js

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

16条回答 默认 最新

  • 零零乙 2014-04-29 05:47
    最佳回答

    Call the global process object's exit method:

    process.exit()
    

    From the docs:

    process.exit([code])

    Ends the process with the specified code. If omitted, exit uses the 'success' code 0.

    To exit with a 'failure' code:

    process.exit(1);
    

    The shell that executed node should see the exit code as 1.

    评论
    解决 无用
    打赏 举报
查看更多回答(15条)

相关推荐 更多相似问题