Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 65b5ccc

Browse filesBrowse files
mscdexMyles Borins
authored andcommitted
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: #7049 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 96ed883 commit 65b5ccc
Copy full SHA for 65b5ccc

File tree

Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-flush-stdio.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-flush-stdio.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ const cp = require('child_process');
33
const common = require('../common');
44
const assert = require('assert');
55

6-
const p = cp.spawn('echo');
6+
// Windows' `echo` command is a built-in shell command and not an external
7+
// executable like on *nix
8+
const opts = { shell: common.isWindows };
9+
10+
const p = cp.spawn('echo', [], opts);
711

812
p.on('close', common.mustCall(function(code, signal) {
913
assert.strictEqual(code, 0);
@@ -15,7 +19,7 @@ p.stdout.read();
1519

1620
function spawnWithReadable() {
1721
const buffer = [];
18-
const p = cp.spawn('echo', ['123']);
22+
const p = cp.spawn('echo', ['123'], opts);
1923
p.on('close', common.mustCall(function(code, signal) {
2024
assert.strictEqual(code, 0);
2125
assert.strictEqual(signal, null);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.