prevent NodeJS program from exiting

后端 未结 2 577
我寻月下人不归
我寻月下人不归 2021-02-08 19:09

I am creating NodeJS based crawler, which is working with node-cron package and I need to prevent entry script from exiting since application should run forever as

2条回答
  •  猫巷女王i
    2021-02-08 19:31

    I think the best way to prevent exit from process is:

    process.stdin.resume();
    

    I found this solution here https://stackoverflow.com/a/14032965/2094090 and it works fine.

提交回复
热议问题