Skip to content

Commit

Permalink
Add /q option to cmd as well as cmd.exe on Windows (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
GMartigny authored and sindresorhus committed Apr 16, 2019
1 parent 136b340 commit 10c73dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -60,7 +60,7 @@ function handleArgs(command, args, options) {
options.cleanup = false;
}

if (process.platform === 'win32' && path.basename(command) === 'cmd.exe') {
if (process.platform === 'win32' && path.basename(command, '.exe') === 'cmd') {
// #116
args.unshift('/q');
}
Expand Down
5 changes: 5 additions & 0 deletions test.js
Expand Up @@ -28,6 +28,11 @@ if (process.platform === 'win32') {
const {stdout} = await execa('hello.cmd');
t.is(stdout, 'Hello World');
});

test('execa() - run cmd command', async t => {
const {stdout} = await execa('cmd', ['/c', 'hello.cmd']);
t.is(stdout, 'Hello World');
});
}

test('buffer', async t => {
Expand Down

0 comments on commit 10c73dc

Please sign in to comment.