diff --git a/bin/vue-init b/bin/vue-init index 9d4812b5f7..8967133a01 100755 --- a/bin/vue-init +++ b/bin/vue-init @@ -150,9 +150,11 @@ function downloadAndGenerate (template) { spinner.start() download(template, tmp, { clone: clone }, function (err) { spinner.stop() + process.on('exit', function () { + rm(tmp) + }) if (err) logger.fatal('Failed to download repo ' + template + ': ' + err.message.trim()) generate(name, tmp, to, function (err) { - rm(tmp) if (err) logger.fatal(err) console.log() logger.success('Generated "%s".', name)