Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aebe624

Browse filesBrowse files
addaleaxevanlucas
authored andcommitted
test: add test for piping large input from stdin
Check that piping a large chunk of data from `process.stdin` into `process.stdout` does not lose any data by verifying that the output has the same size as the input. This is a regression test for #5927 and fails for the commits in the range [ace1009..89abe86). PR-URL: #5949 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent a19de97 commit aebe624
Copy full SHA for aebe624

File tree

Expand file treeCollapse file tree

1 file changed

+23
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+23
-0
lines changed
Open diff view settings
Collapse file
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
// See https://github.com/nodejs/node/issues/5927
3+
4+
const common = require('../common');
5+
const assert = require('assert');
6+
const spawn = require('child_process').spawn;
7+
8+
if (process.argv[2] === 'child') {
9+
process.stdin.pipe(process.stdout);
10+
return;
11+
}
12+
13+
const child = spawn(process.execPath, [__filename, 'child'], { stdio: 'pipe' });
14+
15+
const expectedBytes = 1024 * 1024;
16+
let readBytes = 0;
17+
18+
child.stdin.end(Buffer.alloc(expectedBytes));
19+
20+
child.stdout.on('data', (chunk) => readBytes += chunk.length);
21+
child.stdout.on('end', common.mustCall(() => {
22+
assert.strictEqual(readBytes, expectedBytes);
23+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.