diff --git a/bin/now-deploy.js b/bin/now-deploy.js index dc71f65..81c0691 100755 --- a/bin/now-deploy.js +++ b/bin/now-deploy.js @@ -623,6 +623,22 @@ function printLogs(host, token) { // log build const logger = new Logger(host, {debug, quiet}) + logger.on('error', async () => { + if (!quiet) { + console.log(`${chalk.cyan('> Deployment failed!')}`) + } + + if (gitRepo && gitRepo.cleanup) { + // Delete temporary directory that contains repository + gitRepo.cleanup() + + if (debug) { + console.log(`> [debug] Removed temporary repo directory`) + } + } + process.exit(1) + }) + logger.on('close', async () => { if (Array.isArray(autoAliases)) { const aliasList = autoAliases.filter(item => item !== '') diff --git a/lib/build-logger.js b/lib/build-logger.js index 8a95b1b..fcdfffd 100644 --- a/lib/build-logger.js +++ b/lib/build-logger.js @@ -57,7 +57,6 @@ module.exports = class Logger extends EventEmitter { } if (state.error) { - console.error('> Deployment error') this.emit('error') return }