summaryrefslogtreecommitdiff
path: root/test/parallel/test-pipe-head.js
blob: cb3d183fcdff206083ef0b6ce100fbcbf2ea12fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');

const exec = require('child_process').exec;

const nodePath = process.argv[0];
const script = fixtures.path('print-10-lines.js');

const cmd = `"${nodePath}" "${script}" | head -2`;

exec(cmd, common.mustCall(function(err, stdout, stderr) {
  assert.ifError(err);
  const lines = stdout.split('\n');
  assert.strictEqual(lines.length, 3);
}));