如何从node.js写入System.in?

Rap*_*hie 2 command-line stdin node.js

我想将节点的输入传递给我写的基于命令行的程序.使用child_process.exec可以很容易地启动程序,但是如何在程序启动后传递更多输入?

Mic*_*ley 6

child_processes.exec 返回一个"ChildProcess对象",它有一个名为的属性stdin,它是该进程的可写流stdin.查看文档以获取更多信息.