同步进程创建
【Synchronous process creation】
child_process.spawnSync()、child_process.execSync() 和 child_process.execFileSync() 方法是同步的,会阻塞 Node.js 事件循环,暂停任何其他代码的执行,直到所生成的进程退出。
【The child_process.spawnSync(), child_process.execSync(), and
child_process.execFileSync() methods are synchronous and will block the
Node.js event loop, pausing execution of any additional code until the spawned
process exits.】
像这样的阻塞调用主要用于简化通用脚本任务,以及简化应用启动时的配置加载和处理。
【Blocking calls like these are mostly useful for simplifying general-purpose scripting tasks and for simplifying the loading/processing of application configuration at startup.】