Skip to content

I was wondering what the code at the end of most deploy scripts does (the .then.... parts) #2858

Answered by Hamzakh777
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

The process is an object that's specific to the node.js runtime. You can find documentation about it here https://nodejs.org/api/process.html

main is a promise https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise . then is called when the promise is settled while catch is called if an error happens.

Calling main makes sure that our deploy script actually runs. Once all our code finishes, we call process. exit(0) to close the runtime since nothing is left to execute. The 0 and 1 params we pass to exit are status codes https://stackoverflow.com/questions/43147330/what-is-difference-between-method-process-exit1-and-process-exit0-in-node-js

Hope that…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ghost
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant