test: fix test-child-process-double-pipe
authororangemocha@github.com <orangemocha@github.com>
Mon, 10 Feb 2014 21:41:03 +0000 (22:41 +0100)
committerTimothy J Fontaine <tjfontaine@gmail.com>
Fri, 14 Feb 2014 00:41:31 +0000 (16:41 -0800)
On Windows, grep and sed were stripping the CR character out of CRLF.
Passing --binary will force them to preserve the CR.

test/simple/test-child-process-double-pipe.js

index ff092062202d2ed022ce12ad8c491ea2d1a86ed2..c09dfa885327e603d15eb346abfea9522bc05885 100644 (file)
@@ -30,15 +30,17 @@ var assert = require('assert'),
 // We're trying to reproduce:
 // $ echo "hello\nnode\nand\nworld" | grep o | sed s/o/a/
 
-var grep = spawn('grep', ['o']),
-    sed = spawn('sed', ['s/o/O/']),
-    echo;
+var grep, sed, echo;
 
 if (is_windows) {
+  grep = spawn('grep', ['--binary', 'o']),
+  sed = spawn('sed', ['--binary', 's/o/O/']),
   echo = spawn('cmd.exe',
                ['/c', 'echo', 'hello&&', 'echo',
                 'node&&', 'echo', 'and&&', 'echo', 'world']);
 } else {
+  grep = spawn('grep', ['o']),
+  sed = spawn('sed', ['s/o/O/']),
   echo = spawn('echo', ['hello\nnode\nand\nworld\n']);
 }