Browse Source

test: fix test-child-process-double-pipe

On Windows, grep and sed were stripping the CR character out of CRLF.
Passing --binary will force them to preserve the CR.
v0.11.12-release
orangemocha@github.com 11 years ago
committed by Timothy J Fontaine
parent
commit
e7a03f1c62
  1. 8
      test/simple/test-child-process-double-pipe.js

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

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

Loading…
Cancel
Save