0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/sequential/test-regress-GH-1726.js
Roman Reiss f29762f4dd test: enable linting for tests
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.

test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.

PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-19 21:21:27 +02:00

45 lines
1.0 KiB
JavaScript

'use strict';
// Open a chain of five Node processes each a child of the next. The final
// process exits immediately. Each process in the chain is instructed to
// exit when its child exits.
// https://github.com/joyent/node/issues/1726
var common = require('../common');
var assert = require('assert');
var ch = require('child_process');
var gen = +(process.argv[2] || 0);
var maxGen = 5;
if (gen === maxGen) {
console.error('hit maxGen, exiting', maxGen);
return;
}
var child = ch.spawn(process.execPath, [__filename, gen + 1], {
stdio: [ 'ignore', 'pipe', 'ignore' ]
});
assert.ok(!child.stdin);
assert.ok(child.stdout);
assert.ok(!child.stderr);
console.error('gen=%d, pid=%d', gen, process.pid);
/*
var timer = setTimeout(function() {
throw new Error('timeout! gen='+gen);
}, 1000);
*/
child.on('exit', function(code) {
console.error('exit %d from gen %d', code, gen + 1);
//clearTimeout(timer);
});
child.stdout.pipe(process.stdout);
child.stdout.on('close', function() {
console.error('child.stdout close gen=%d', gen);
});