Bug fix: async's callback was called twice

This commit is contained in:
Petros Angelatos 2013-07-21 14:31:14 +01:00
parent cb434292bf
commit 3c49f64dbc

View File

@ -52,7 +52,11 @@ class Application
shouldRestartApp = Boolean(@process) shouldRestartApp = Boolean(@process)
tasks = [ tasks = [
# Stop the application if running # Stop the application if running
(callback) => shouldRestartApp and @_stop(callback) or callback() (callback) =>
if shouldRestartApp
@_stop(callback)
else
callback()
# Pull new commits # Pull new commits
(callback) => (callback) =>
@ -63,7 +67,11 @@ class Application
spawn('npm', ['install'], @options).on('exit', callback).on('error', callback) spawn('npm', ['install'], @options).on('exit', callback).on('error', callback)
# Start the app # Start the app
(callback) => shouldRestartApp and @_start(callback) or callback() (callback) =>
if shouldRestartApp
@_start(callback)
else
callback()
] ]
async.series(tasks, callback) async.series(tasks, callback)