Skip to content

Commit 896073b

Browse files
lpincatargos
authored andcommitted
test: deflake child-process-pipe-dataflow
Fixes: #25988 PR-URL: #40838 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent c2259c9 commit 896073b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/parallel/test-child-process-pipe-dataflow.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const common = require('../common');
33
const assert = require('assert');
44
const path = require('path');
55
const fs = require('fs');
6-
const os = require('os');
76
const spawn = require('child_process').spawn;
87
const tmpdir = require('../common/tmpdir');
98

@@ -22,12 +21,13 @@ const MB = KB * KB;
2221
const file = path.resolve(tmpdir.path, 'data.txt');
2322
const buf = Buffer.alloc(MB).fill('x');
2423

25-
// Most OS commands that deal with data, attach special
26-
// meanings to new line - for example, line buffering.
27-
// So cut the buffer into lines at some points, forcing
28-
// data flow to be split in the stream.
24+
// Most OS commands that deal with data, attach special meanings to new line -
25+
// for example, line buffering. So cut the buffer into lines at some points,
26+
// forcing data flow to be split in the stream. Do not use os.EOL for \n as
27+
// that is 2 characters on Windows and is sometimes converted to 1 character
28+
// which causes the test to fail.
2929
for (let i = 1; i < KB; i++)
30-
buf.write(os.EOL, i * KB);
30+
buf.write('\n', i * KB);
3131
fs.writeFileSync(file, buf.toString());
3232

3333
cat = spawn('cat', [file]);

0 commit comments

Comments
 (0)