Skip to content
Permalink
Browse files
Turn off echo on Windows - fixes #116 (#118)
  • Loading branch information
SamVerschueren authored and sindresorhus committed Dec 31, 2017
1 parent 5f890ab commit ff762355930ff3d689bf452e8e966e388c63e86c
Showing 3 changed files with 15 additions and 0 deletions.
@@ -0,0 +1 @@
ECHO Hello World
@@ -1,4 +1,5 @@
'use strict';
const path = require('path');
const childProcess = require('child_process');
const util = require('util');
const crossSpawn = require('cross-spawn');
@@ -59,6 +60,11 @@ function handleArgs(cmd, args, opts) {
opts.cleanup = false;
}

if (process.platform === 'win32' && path.basename(parsed.command) === 'cmd.exe') {
// #116
parsed.args.unshift('/q');
}

return {
cmd: parsed.command,
args: parsed.args,
@@ -17,6 +17,14 @@ test('execa()', async t => {
t.is(stdout, 'foo');
});

if (process.platform === 'win32') {
test('execa() - cmd file', async t => {
const {stdout} = await m('hello.cmd');

t.is(stdout, 'Hello World');
});
}

test('buffer', async t => {
const {stdout} = await m('noop', ['foo'], {encoding: null});
t.true(Buffer.isBuffer(stdout));

0 comments on commit ff76235

Please sign in to comment.