Browse Source

Add some debug output to test-child-process-double-pipe

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
2c11718d79
  1. 15
      test/simple/test-child-process-double-pipe.js

15
test/simple/test-child-process-double-pipe.js

@ -44,6 +44,7 @@ var echo = spawn('echo', ['hello\nnode\nand\nworld\n']),
// pipe echo | grep // pipe echo | grep
echo.stdout.on('data', function(data) { echo.stdout.on('data', function(data) {
console.error("grep stdin write " + data.length);
if (!grep.stdin.write(data)) { if (!grep.stdin.write(data)) {
echo.stdout.pause(); echo.stdout.pause();
} }
@ -58,10 +59,23 @@ echo.stdout.on('end', function(code) {
grep.stdin.end(); grep.stdin.end();
}); });
echo.on('exit', function() {
console.error("echo exit");
})
grep.on('exit', function() {
console.error("grep exit");
})
sed.on('exit', function() {
console.error("sed exit");
})
// pipe grep | sed // pipe grep | sed
grep.stdout.on('data', function(data) { grep.stdout.on('data', function(data) {
console.error("grep stdout " + data.length);
if (!sed.stdin.write(data)) { if (!sed.stdin.write(data)) {
grep.stdout.pause(); grep.stdout.pause();
} }
@ -73,6 +87,7 @@ sed.stdin.on('drain', function(data) {
// propagate end from grep to sed // propagate end from grep to sed
grep.stdout.on('end', function(code) { grep.stdout.on('end', function(code) {
console.error("grep stdout end");
sed.stdin.end(); sed.stdin.end();
}); });

Loading…
Cancel
Save