Skip to content

Commit

Permalink
fix(windows): escape prefix path on windows
Browse files Browse the repository at this point in the history
Closes zkat#100
  • Loading branch information
brianpeiris committed Dec 7, 2017
1 parent 357e6ab commit 1521744
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function getNpmCache (opts) {
module.exports._buildArgs = buildArgs
function buildArgs (specs, prefix, opts) {
const args = ['install'].concat(specs)
args.push('--global', '--prefix', prefix)
args.push('--global', '--prefix', process.platform === 'win32' ? `"${prefix}"` : prefix)
if (opts.cache) args.push('--cache', opts.cache)
if (opts.userconfig) args.push('--userconfig', opts.userconfig)
args.push('--loglevel', 'error', '--json')
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ test('installPackages unit', t => {
NPM_PATH,
'install', 'installme@latest', 'file:foo',
'--global',
'--prefix', 'myprefix',
'--prefix', isWindows ? '"myprefix"' : 'myprefix',
'--loglevel', 'error',
'--json'
], 'args to spawn were correct for installing requested package')
Expand Down

0 comments on commit 1521744

Please sign in to comment.