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