test: add batch of known issue tests
[platform/upstream/nodejs.git] / test / known_issues / test-process-external-stdio-close.js
1 'use strict';
2 // Refs: https://github.com/nodejs/node/issues/947
3 const common = require('../common');
4 const assert = require('assert');
5 const cp = require('child_process');
6
7 if (process.argv[2] === 'child') {
8   process.on('message', common.mustCall((msg) => {
9     assert.strictEqual(msg, 'go');
10     console.log('logging should not cause a crash');
11     process.disconnect();
12   }));
13 } else {
14   const child = cp.fork(__filename, ['child'], {silent: true});
15
16   child.on('close', common.mustCall((exitCode, signal) => {
17     assert.strictEqual(exitCode, 0);
18     assert.strictEqual(signal, null);
19   }));
20
21   child.stdout.destroy();
22   child.send('go');
23 }