Browse Source

[debugger] print data from child process' stdout and stderr

Fedor Indutny 13 years ago
parent
commit
5a3639985a
  1. 10
      lib/_debugger.js

10
lib/_debugger.js

@ -715,6 +715,14 @@ Interface.prototype.print = function(text) {
process.stdout.write(text + '\n');
};
Interface.prototype.foreignPrint = function(text) {
this.print(text.toString().split(/\r\n|\r|\n/g).filter(function(chunk) {
return chunk;
}).map(function(chunk) {
return '< ' + chunk;
}).join('\n'));
};
Interface.prototype.handleBreak = function(r) {
this.pause();
@ -1095,6 +1103,8 @@ Interface.prototype.trySpawn = function(cb) {
this.child = spawn(process.execPath, args, { customFds: [0, 1, 2] });
this.child.stdout.on('data', this.foreignPrint.bind(this));
this.child.stderr.on('data', this.foreignPrint.bind(this));
this.pause();

Loading…
Cancel
Save