diff options
author | Luigi Pinca <luigipinca@gmail.com> | 2021-11-17 15:10:19 +0300 |
---|---|---|
committer | Beth Griggs <bgriggs@redhat.com> | 2021-11-29 20:33:44 +0300 |
commit | 01ffe0316cf1cd270d13efd5bd61752d87d4dd0f (patch) | |
tree | 786afac8cfe49ed6a5effe56e24e7f1dca950f57 | |
parent | 480f0e1d20006a59500afb0b3a2176edbb483bb6 (diff) |
test: deflake child-process-pipe-dataflow
Fixes: https://github.com/nodejs/node/issues/25988
PR-URL: https://github.com/nodejs/node/pull/40838
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
-rw-r--r-- | test/parallel/test-child-process-pipe-dataflow.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/parallel/test-child-process-pipe-dataflow.js b/test/parallel/test-child-process-pipe-dataflow.js index 2e2edc65e9e..e989ff135c8 100644 --- a/test/parallel/test-child-process-pipe-dataflow.js +++ b/test/parallel/test-child-process-pipe-dataflow.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const path = require('path'); const fs = require('fs'); -const os = require('os'); const spawn = require('child_process').spawn; const tmpdir = require('../common/tmpdir'); @@ -22,12 +21,13 @@ const MB = KB * KB; const file = path.resolve(tmpdir.path, 'data.txt'); const buf = Buffer.alloc(MB).fill('x'); - // Most OS commands that deal with data, attach special - // meanings to new line - for example, line buffering. - // So cut the buffer into lines at some points, forcing - // data flow to be split in the stream. + // Most OS commands that deal with data, attach special meanings to new line - + // for example, line buffering. So cut the buffer into lines at some points, + // forcing data flow to be split in the stream. Do not use os.EOL for \n as + // that is 2 characters on Windows and is sometimes converted to 1 character + // which causes the test to fail. for (let i = 1; i < KB; i++) - buf.write(os.EOL, i * KB); + buf.write('\n', i * KB); fs.writeFileSync(file, buf.toString()); cat = spawn('cat', [file]); |