2010-07-16 02:47:25 +08:00
|
|
|
common = require("../common");
|
|
|
|
assert = common.assert
|
2010-04-23 05:25:13 +08:00
|
|
|
|
|
|
|
exec = require('child_process').exec;
|
|
|
|
join = require('path').join;
|
|
|
|
|
|
|
|
nodePath = process.argv[0];
|
2010-07-16 02:47:25 +08:00
|
|
|
script = join(common.fixturesDir, 'print-10-lines.js');
|
2010-04-23 05:25:13 +08:00
|
|
|
|
|
|
|
cmd = nodePath + ' ' + script + ' | head -2';
|
|
|
|
|
|
|
|
finished = false;
|
|
|
|
|
|
|
|
exec(cmd, function (err, stdout, stderr) {
|
|
|
|
if (err) throw err;
|
|
|
|
lines = stdout.split('\n');
|
|
|
|
assert.equal(3, lines.length);
|
|
|
|
finished = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
process.addListener('exit', function () {
|
|
|
|
assert.ok(finished);
|
|
|
|
});
|