How to forcibly keep a Node.js process from terminating?

前端 未结 3 1605
清歌不尽
清歌不尽 2020-12-23 17:11

TL;DR

What is the best way to forcibly keep a Node.js process running, i.e., keep its event loop from running empty and hence keeping the process from terminating?

3条回答
  •  情歌与酒
    2020-12-23 18:08

    Use "old" Streams mode to listen for a standard input that will never come:

    // Start reading from stdin so we don't exit.
    process.stdin.resume();
    

提交回复
热议问题