From 3c49f64dbcc2e689fd452eafad869200ff14c574 Mon Sep 17 00:00:00 2001 From: Petros Angelatos Date: Sun, 21 Jul 2013 14:31:14 +0100 Subject: [PATCH] Bug fix: async's callback was called twice --- application.coffee | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/application.coffee b/application.coffee index aa6460a9..0767cd66 100644 --- a/application.coffee +++ b/application.coffee @@ -52,7 +52,11 @@ class Application shouldRestartApp = Boolean(@process) tasks = [ # Stop the application if running - (callback) => shouldRestartApp and @_stop(callback) or callback() + (callback) => + if shouldRestartApp + @_stop(callback) + else + callback() # Pull new commits (callback) => @@ -63,7 +67,11 @@ class Application spawn('npm', ['install'], @options).on('exit', callback).on('error', callback) # Start the app - (callback) => shouldRestartApp and @_start(callback) or callback() + (callback) => + if shouldRestartApp + @_start(callback) + else + callback() ] async.series(tasks, callback)