@@ -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+}