Node.js 如何从子进程实时重定向stdout

Node.js 如何从子进程实时重定向stdout,node.js,process,pipe,node-webkit,nw.js,Node.js,Process,Pipe,Node Webkit,Nw.js,我有一个长时间运行的子进程 {stdio:'inherit'} 因此,我可以看到它在控制台中执行的任何操作 如何重定向此信息,使其显示在我的节点webkit应用程序上?只需以某种方式处理标准数据流中的数据事件即可 childProc.stdout.on('data', function (chunk) { // Write chunk to the page using whatever normal method you like });

我有一个长时间运行的子进程

{stdio:'inherit'}

因此,我可以看到它在控制台中执行的任何操作


如何重定向此信息,使其显示在我的节点webkit应用程序上?

只需以某种方式处理标准数据流中的数据事件即可

childProc.stdout.on('data', function (chunk) {
  // Write chunk to the page using whatever normal method you like
});