@@ -3,7 +3,6 @@ const common = require('../common');
33const assert = require ( 'assert' ) ;
44const path = require ( 'path' ) ;
55const fs = require ( 'fs' ) ;
6- const os = require ( 'os' ) ;
76const spawn = require ( 'child_process' ) . spawn ;
87const 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