Skip to content

Commit

Permalink
fix: windows ComSpec env variable name
Browse files Browse the repository at this point in the history
This looks like a typo in the original implementation, based on
references to this same variable in the npm cli config.

PR-URL: #27
Credit: @ruyadorno
Close: #27
Reviewed-by: @wraithgar
  • Loading branch information
ruyadorno committed Apr 22, 2021
1 parent 2a2f1b6 commit 988cd66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -103,7 +103,7 @@ terminal, then it is up to the user to end it, of course.
- The `package.json` fields described in
[RFC183](https://github.com/npm/rfcs/pull/183/files).
- `scriptShell` Optional, defaults to `/bin/sh` on Unix, defaults to
`env.comspec` or `cmd` on Windows. Custom script to use to execute the
`env.ComSpec` or `cmd` on Windows. Custom script to use to execute the
command.
- `stdio` Optional, defaults to `'pipe'`. The same as the `stdio` argument
passed to `child_process` functions in Node.js. Note that if a stdio
Expand Down
2 changes: 1 addition & 1 deletion lib/make-spawn-args.js
Expand Up @@ -8,7 +8,7 @@ const makeSpawnArgs = options => {
const {
event,
path,
scriptShell = isWindows ? process.env.comspec || 'cmd' : 'sh',
scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh',
env = {},
stdio,
cmd,
Expand Down
8 changes: 4 additions & 4 deletions test/make-spawn-args.js
Expand Up @@ -16,8 +16,8 @@ const makeSpawnArgs = requireInject('../lib/make-spawn-args.js', {

if (isWindows) {
t.test('windows', t => {
// with no comspec
delete process.env.comspec
// with no ComSpec
delete process.env.ComSpec
t.match(makeSpawnArgs({
event: 'event',
path: 'path',
Expand All @@ -38,8 +38,8 @@ if (isWindows) {
}
])

// with a funky comspec
process.env.comspec = 'blrorp'
// with a funky ComSpec
process.env.ComSpec = 'blrorp'
t.match(makeSpawnArgs({
event: 'event',
path: 'path',
Expand Down

0 comments on commit 988cd66

Please sign in to comment.