【发布时间】:2015-02-18 12:23:28
【问题描述】:
在我的 Node-Webkit 应用程序中,我使用 exec() 来执行子应用程序。应用程序将一些调试信息打印到 shell。
问题是 stdout 仅在子应用程序退出后发送文本。
有没有办法在子应用程序运行时使用标准输出信息更新 div 元素?
var exec = require('child_process').exec;
exec(executableFile, function (error, stdout, stderr) {
if (stdout) {
// this only updates after the app exits
console.log('stdout: ' + stdout);
$('#console-output').append('stdout: ' + stdout +'<br/>');
}
if (error !== null) {
console.log('exec error: ' + error);
}
});
【问题讨论】:
标签: javascript windows node.js shell node-webkit