on master help sign in
Add special logic to get binary working on Windows
commit14b971654cdf0f4433ce6617e8d4df19049395c5 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 10 May 2019, 14:18 (7 years ago) parentd0a2421
2 files changed+4−2
installers/npm/bin/elm+3−1 installers/npm/download.js+1−1
installers/npm/bin/elm+3−1
@@ -20,7 +20,9 @@ var fs = require('fs');
2020var pathToThisFile = fs.realpathSync(process.argv[1]);
2121
2222download(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
2325 child_process
24− .spawn(pathToThisFile, process.argv.slice(2), { stdio: 'inherit' })
26+ .spawn('"' + pathToThisFile + '"', process.argv.slice(2), { stdio: 'inherit', shell: true })
2527 .on('exit', process.exit);
2628});
installers/npm/download.js+1−1
@@ -19,7 +19,7 @@ module.exports = function(destinationPath, callback)
1919 var arch = { 'x64': '64-bit', 'ia32': '32-bit' }[process.arch];
2020
2121 download(
22− destinationPath,
22+ process.platform === 'win32' ? destinationPath + '.exe' : destinationPath,
2323 'https://github.com/elm/compiler/releases/download/' + version + '/binary-for-' + os + '-' + arch + '.gz',
2424 callback
2525 );