你可以这样做
var cp = require("child_process");cp.exec("document.docx"); // notice this without a callback..process.exit(0); // exit this nodejs process出于安全考虑,请确保该命令未显示任何错误或任何不希望的输出
您应该添加回调参数
child_process.exec(cmd,function(error,stdout,stderr){})接下来,您可以处理事件,这样就不会阻止脚本的执行,甚至不会使用外部的node.js脚本来启动和处理从“主”脚本生成的进程的输出。



