0
0
Node.jsframework~5 mins

Child process exit codes in Node.js - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is an exit code in the context of a child process in Node.js?
An exit code is a number returned by a child process when it finishes running. It tells if the process ended successfully or if there was an error.
Click to reveal answer
beginner
What does an exit code of 0 usually mean for a child process?
An exit code of 0 means the child process finished successfully without errors.
Click to reveal answer
intermediate
How can you listen for a child process exit event in Node.js?
You can listen for the 'exit' event on the child process object to get the exit code and signal when the process ends.
Click to reveal answer
beginner
What does a non-zero exit code indicate?
A non-zero exit code means the child process ended with an error or was terminated unexpectedly.
Click to reveal answer
intermediate
What is the difference between the 'exit' and 'close' events on a child process?
The 'exit' event gives the exit code and signal when the process ends. The 'close' event fires after all stdio streams are closed, indicating the process fully finished.
Click to reveal answer
What does an exit code of 0 from a child process mean?
AProcess finished successfully
BProcess crashed
CProcess was killed by a signal
DProcess is still running
Which event do you listen to get the exit code of a child process in Node.js?
Aerror
Bstart
Cexit
Ddata
What does a non-zero exit code usually indicate?
ASuccessful completion
BAn error or abnormal termination
CProcess is waiting
DProcess is paused
What is the difference between the 'exit' and 'close' events on a child process?
ANeither event provides exit code
B'close' fires when process ends; 'exit' fires after stdio streams close
CBoth fire at the same time
D'exit' fires when process ends; 'close' fires after stdio streams close
If a child process is terminated by a signal, what will the exit code be?
Anull or undefined
BNon-zero number
C0
DIt will be the signal number
Explain what child process exit codes are and how you can use them in Node.js.
Think about how a child process tells you if it finished well or had problems.
You got /4 concepts.
    Describe the difference between the 'exit' and 'close' events on a Node.js child process and why both might be useful.
    Consider what happens when a process ends versus when its output streams finish.
    You got /4 concepts.