mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 09:52:21 +00:00

Previously getting this error when running `tap2junit` (what parses our `.tap` files in CI): ``` Traceback (most recent call last): File "/usr/local/bin/tap2junit", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/tap2junit/__main__.py", line 46, in main result.to_file(args.output, [result], prettyprint=False) File "/usr/local/lib/python2.7/site-packages/junit_xml/__init__.py", line 289, in to_file test_suites, prettyprint=prettyprint, encoding=encoding) File "/usr/local/lib/python2.7/site-packages/junit_xml/__init__.py", line 257, in to_xml_string ts_xml = ts.build_xml_doc(encoding=encoding) File "/usr/local/lib/python2.7/site-packages/junit_xml/__init__.py", line 221, in build_xml_doc attrs['message'] = decode(case.skipped_message, encoding) File "/usr/local/lib/python2.7/site-packages/junit_xml/__init__.py", line 68, in decode ret = unicode(var) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 11: ordinal not in range(128) ``` PR-URL: https://github.com/nodejs/node/pull/21793 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.isMainThread)
|
|
common.skip("Workers don't have process-like stdio");
|
|
|
|
// Test if Node handles redirecting one child process stdout to another
|
|
// process stdin without crashing.
|
|
const spawn = require('child_process').spawn;
|
|
|
|
const writeSize = 100;
|
|
const totalDots = 10000;
|
|
|
|
const who = process.argv.length <= 2 ? 'parent' : process.argv[2];
|
|
|
|
switch (who) {
|
|
case 'parent':
|
|
const consumer = spawn(process.argv0, [process.argv[1], 'consumer'], {
|
|
stdio: ['pipe', 'ignore', 'inherit'],
|
|
});
|
|
const producer = spawn(process.argv0, [process.argv[1], 'producer'], {
|
|
stdio: ['pipe', consumer.stdin, 'inherit'],
|
|
});
|
|
process.stdin.on('data', () => {});
|
|
producer.on('exit', process.exit);
|
|
break;
|
|
case 'producer':
|
|
const buffer = Buffer.alloc(writeSize, '.');
|
|
let written = 0;
|
|
const write = () => {
|
|
if (written < totalDots) {
|
|
written += writeSize;
|
|
process.stdout.write(buffer, write);
|
|
}
|
|
};
|
|
write();
|
|
break;
|
|
case 'consumer':
|
|
process.stdin.on('data', () => {});
|
|
break;
|
|
}
|