2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2010-12-05 00:20:34 +01:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
2010-12-04 23:45:52 +01:00
|
|
|
|
2010-12-05 01:11:57 +01:00
|
|
|
var exec = require('child_process').exec;
|
|
|
|
var join = require('path').join;
|
2010-04-22 23:25:13 +02:00
|
|
|
|
2010-12-05 01:11:57 +01:00
|
|
|
var nodePath = process.argv[0];
|
|
|
|
var script = join(common.fixturesDir, 'print-10-lines.js');
|
2010-04-22 23:25:13 +02:00
|
|
|
|
2010-12-27 01:32:04 +01:00
|
|
|
var cmd = '"' + nodePath + '" "' + script + '" | head -2';
|
2010-04-22 23:25:13 +02:00
|
|
|
|
2010-12-05 01:11:57 +01:00
|
|
|
var finished = false;
|
2010-04-22 23:25:13 +02:00
|
|
|
|
2010-12-04 23:45:52 +01:00
|
|
|
exec(cmd, function(err, stdout, stderr) {
|
2010-04-22 23:25:13 +02:00
|
|
|
if (err) throw err;
|
2010-12-05 01:11:57 +01:00
|
|
|
var lines = stdout.split('\n');
|
2010-04-22 23:25:13 +02:00
|
|
|
assert.equal(3, lines.length);
|
|
|
|
finished = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2011-10-15 01:08:36 +02:00
|
|
|
process.on('exit', function() {
|
2010-04-22 23:25:13 +02:00
|
|
|
assert.ok(finished);
|
|
|
|
});
|