Node.js · Middle · Question 52 of 75

What is the difference between child_process.exec and child_process.spawn?

Explanation

Use spawn or execFile for large output or untrusted arguments. Passing user input to exec risks command injection.

Further reading

Problem with a question

Node.js · Middle · question 52

Test yourself

Take the Node.js · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz