• 主页
  • 在nodejs中使用exec()创建新进程时,是否与当前进程并行运行,nodejs如何处理?

在nodejs中使用exec()创建新进程时,是否与当前进程并行运行,nodejs如何处理?

既然nodejs是单线程语言,那么它是如何创建和处理新进程的。

const exec = require('child_process').exec;  
exec('my.bat', (err, stdout, stderr) => {  
  if (err) {  
    console.error(err);  
    return;  
  }  
  console.log(stdout);  
});  

转载请注明出处:http://www.jubohx.com/article/20230504/953623.html