Node.js 创建子进程详解
利用 Node.js 创建子进程的步骤如下:
- 使用
child_process.fork()
或child_process.spawn()
创建一个子进程。 - 在父进程中使用
subprocess.on()
监听子进程的事件。 - 在子进程中使用
subprocess.send()
向父进程发送消息。 - 在父进程中使用
subprocess.kill()
或subprocess.exit()
终止子进程。
60.73KB
文件大小:
评论区