We can use mapSync as we don't need anything asynchronous, also we can return nothing as we're done with the stream data at that point.

This commit is contained in:
Pagan Gazzard 2014-10-03 18:54:08 +01:00 committed by Pablo Carranza Vélez
parent ef4c4b9ae6
commit 85e1777a65

View File

@ -48,12 +48,12 @@ startNewSupervisor = (currentSupervisor, waitForSuccess = true) ->
es.pipeline(
stream
es.split()
es.map (line, callback) ->
es.mapSync (line) ->
# ignore first 8 characters of every line that are a header sent by docker attach
data = line.substr(8)
if data is config.successMessage
resolve(container)
callback(null, data)
return
)
stream.on 'end', ->
reject(new Error('New supervisor stopped before success message'))