@@ -3,7 +3,6 @@ const common = require('../common');
3
3
const assert = require ( 'assert' ) ;
4
4
const path = require ( 'path' ) ;
5
5
const fs = require ( 'fs' ) ;
6
- const os = require ( 'os' ) ;
7
6
const spawn = require ( 'child_process' ) . spawn ;
8
7
const tmpdir = require ( '../common/tmpdir' ) ;
9
8
@@ -22,12 +21,13 @@ const MB = KB * KB;
22
21
const file = path . resolve ( tmpdir . path , 'data.txt' ) ;
23
22
const buf = Buffer . alloc ( MB ) . fill ( 'x' ) ;
24
23
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.
29
29
for ( let i = 1 ; i < KB ; i ++ )
30
- buf . write ( os . EOL , i * KB ) ;
30
+ buf . write ( '\n' , i * KB ) ;
31
31
fs . writeFileSync ( file , buf . toString ( ) ) ;
32
32
33
33
cat = spawn ( 'cat' , [ file ] ) ;
0 commit comments