2010-07-15 20:47:25 +02:00
|
|
|
common = require("../common");
|
|
|
|
assert = common.assert
|
2010-03-17 22:00:17 +01:00
|
|
|
var path = require('path');
|
|
|
|
var spawn = require('child_process').spawn;
|
2010-07-15 20:47:25 +02:00
|
|
|
var sub = path.join(common.fixturesDir, 'print-chars.js');
|
2010-03-17 22:00:17 +01:00
|
|
|
|
|
|
|
n = 500000;
|
|
|
|
|
|
|
|
var child = spawn(process.argv[0], [sub, n]);
|
|
|
|
|
|
|
|
var count = 0;
|
|
|
|
|
|
|
|
child.stderr.setEncoding('utf8');
|
|
|
|
child.stderr.addListener("data", function (data) {
|
2010-06-24 02:40:51 +02:00
|
|
|
console.log("parent stderr: " + data);
|
2010-03-17 22:00:17 +01:00
|
|
|
assert.ok(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
child.stderr.setEncoding('utf8');
|
|
|
|
child.stdout.addListener("data", function (data) {
|
|
|
|
count += data.length;
|
2010-06-24 02:40:51 +02:00
|
|
|
console.log(count);
|
2010-03-17 22:00:17 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
child.addListener("exit", function (data) {
|
|
|
|
assert.equal(n, count);
|
2010-06-24 02:40:51 +02:00
|
|
|
console.log("okay");
|
2010-03-17 22:00:17 +01:00
|
|
|
});
|