0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/sequential/test-pipe-head.js

26 lines
549 B
JavaScript
Raw Normal View History

'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-12-05 01:11:57 +01:00
var nodePath = process.argv[0];
var script = join(common.fixturesDir, 'print-10-lines.js');
2010-12-27 01:32:04 +01:00
var cmd = '"' + nodePath + '" "' + script + '" | head -2';
2010-12-05 01:11:57 +01:00
var finished = false;
2010-12-04 23:45:52 +01:00
exec(cmd, function(err, stdout, stderr) {
if (err) throw err;
2010-12-05 01:11:57 +01:00
var lines = stdout.split('\n');
assert.equal(3, lines.length);
finished = true;
});
process.on('exit', function() {
assert.ok(finished);
});