How does exec in Nodejs prevent exec content from being exported to the console?

  node.js, question

For example, in the command child_process.exec, how do you prevent the executed command from returning to the console?

I wouldn’t have hit the console. Try it:

var child = require('child_process');
 
 child.exec('ls', function(err, sto) {
 console.log(sto);  //sto is the real output, do you want to print it to the console, by yourself
 });