on master help sign in
try to make some code more self-documenting
commit7b9fac4460ce673245fcd0831bcbd11fa97176da authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 30 Aug 2019, 12:37 (7 years ago) parent41ec49e
1 file changed+13−7
installers/npm/bin/elm.cmd+13−7
installers/npm/bin/elm.cmd+13−7
@@ -20,10 +20,16 @@ var fs = require('fs');
2020// node_modules/.bin/ executable
2121var targetPath = fs.realpathSync(process.argv[1]);
2222
23−download(targetPath, function() {
24− // Need double quotes and { shell: true } when there are spaces in the path on windows:
25− // https://github.com/nodejs/node/issues/7367#issuecomment-229721296
26− child_process
27− .spawn('"' + targetPath + '"', process.argv.slice(2), { stdio: 'inherit', shell: true })
28− .on('exit', process.exit);
29−});
23+download(targetPath, runOriginalCommandWithDownloadedBinary);
24+
25+
26+// If the binary downloads successfully, try to run the original command.
27+function runOriginalCommandWithDownloadedBinary()
28+{
29+ // Need double quotes and { shell: true } when there are spaces in the path on windows:
30+ // https://github.com/nodejs/node/issues/7367#issuecomment-229721296
31+ //
32+ child_process
33+ .spawn('"' + targetPath + '"', process.argv.slice(2), { stdio: 'inherit', shell: true })
34+ .on('exit', process.exit);
35+}