aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2016-05-29 12:21:02 -0400
committerBrian White <mscdex@mscdex.net>2016-06-07 00:04:23 -0400
commite18a9264f3cf7bad47d1887eabe86c4a74c58a6b (patch)
tree11163341b841b07aadfa00c6416b2666c47b38fb
parent015574402417bc3f2d285407a7816a84a89a7830 (diff)
downloadandroid-node-v8-e18a9264f3cf7bad47d1887eabe86c4a74c58a6b.tar.gz
android-node-v8-e18a9264f3cf7bad47d1887eabe86c4a74c58a6b.tar.bz2
android-node-v8-e18a9264f3cf7bad47d1887eabe86c4a74c58a6b.zip
test: fix spawn on windows
Most Windows systems do not have an external `echo` program installed, so any attempts to spawn `echo` as a child process will fail with `ENOENT`. This commit forces the use of the built-in `echo` provided by `cmd.exe`. PR-URL: https://github.com/nodejs/node/pull/7049 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
-rw-r--r--test/parallel/test-child-process-flush-stdio.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/parallel/test-child-process-flush-stdio.js b/test/parallel/test-child-process-flush-stdio.js
index dacc1226f3..c2cae2069a 100644
--- a/test/parallel/test-child-process-flush-stdio.js
+++ b/test/parallel/test-child-process-flush-stdio.js
@@ -3,7 +3,11 @@ const cp = require('child_process');
const common = require('../common');
const assert = require('assert');
-const p = cp.spawn('echo');
+// Windows' `echo` command is a built-in shell command and not an external
+// executable like on *nix
+const opts = { shell: common.isWindows };
+
+const p = cp.spawn('echo', [], opts);
p.on('close', common.mustCall(function(code, signal) {
assert.strictEqual(code, 0);
@@ -15,7 +19,7 @@ p.stdout.read();
function spawnWithReadable() {
const buffer = [];
- const p = cp.spawn('echo', ['123']);
+ const p = cp.spawn('echo', ['123'], opts);
p.on('close', common.mustCall(function(code, signal) {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);