How can I exit the js script node from a script?

Right now I have a nodeJS script that installs a database for me. Whenever I run it on the command line, I need ctrl-C to exit the script. I am assuming that there is some kind of command in nodeJS to force it to exit by itself when it was done, but I cannot find such a command by doing a search in interwebz. Does anyone know if this is possible, and if so, which team?

+6
source share
2 answers

you can exit the script by calling process.exit () (see http://nodejs.org/docs/v0.5.4/api/process.html#process.exit )

+9
source

you should use process.exit (). You can also transfer any status that will be displayed in the console log.

+1
source

Source: https://habr.com/ru/post/894953/


All Articles