Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix spawn on windows #7049

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/parallel/test-child-process-flush-stdio.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down