node/test/parallel/test-pipe-head.js
Santiago Gimeno 2dc5ad460a test: move more tests from sequential to parallel
Only `test-stdin-from-file.js` has been modified so that the `stdin.txt`
is written in a temp directory instead of the `fixtures` directory.

PR-URL: https://github.com/nodejs/node/pull/6187
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 09:14:33 -07:00

26 lines
549 B
JavaScript

'use strict';
var common = require('../common');
var assert = require('assert');
var exec = require('child_process').exec;
var join = require('path').join;
var nodePath = process.argv[0];
var script = join(common.fixturesDir, 'print-10-lines.js');
var cmd = '"' + nodePath + '" "' + script + '" | head -2';
var finished = false;
exec(cmd, function(err, stdout, stderr) {
if (err) throw err;
var lines = stdout.split('\n');
assert.equal(3, lines.length);
finished = true;
});
process.on('exit', function() {
assert.ok(finished);
});