Skip to content

Commit

Permalink
ensure tmp folder is always removed no matter how process exits
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 9, 2016
1 parent 27cd92d commit fa868e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bin/vue-init
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fa868e9

Please sign in to comment.