on master help sign in
Add special logic to get binary working on Windows
14b9716Evan Czaplicki
installers/npm/bin/elm+3−1
@@ -20,7 +20,9 @@ var fs = require('fs');
20var pathToThisFile = fs.realpathSync(process.argv[1]);
20var pathToThisFile = fs.realpathSync(process.argv[1]);
21
21
22download(pathToThisFile, function() {
22download(pathToThisFile, function() {
23+ // Need double quotes and { shell: true } when there are spaces in the path on windows:
24+ // https://github.com/nodejs/node/issues/7367#issuecomment-229721296
23 child_process
25 child_process
24− .spawn(pathToThisFile, process.argv.slice(2), { stdio: 'inherit' })
26+ .spawn('"' + pathToThisFile + '"', process.argv.slice(2), { stdio: 'inherit', shell: true })
25 .on('exit', process.exit);
27 .on('exit', process.exit);
26});
28});
installers/npm/download.js+1−1
@@ -19,7 +19,7 @@ module.exports = function(destinationPath, callback)
19 var arch = { 'x64': '64-bit', 'ia32': '32-bit' }[process.arch];
19 var arch = { 'x64': '64-bit', 'ia32': '32-bit' }[process.arch];
20
20
21 download(
21 download(
22− destinationPath,
22+ process.platform === 'win32' ? destinationPath + '.exe' : destinationPath,
23 'https://github.com/elm/compiler/releases/download/' + version + '/binary-for-' + os + '-' + arch + '.gz',
23 'https://github.com/elm/compiler/releases/download/' + version + '/binary-for-' + os + '-' + arch + '.gz',
24 callback
24 callback
25 );
25 );