mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 05:37:53 +00:00
Bug fix: async's callback was called twice
This commit is contained in:
parent
cb434292bf
commit
3c49f64dbc
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user