in app/packer/PackerProcessMonitor.scala [44:66]
private def processNextLine(
process: Process,
reader: BufferedReader,
bakeId: BakeId,
eventBus: EventBus,
logNumber: Int = 0
): Unit = {
val line = reader.readLine()
if (line != null) {
var nextLogNumber = logNumber
PackerOutputParser.parseLine(line).foreach {
case PackerOutputParser.UiOutput(logLevel, messageParts) =>
val bakeLog =
BakeLog(bakeId, logNumber, DateTime.now, logLevel, messageParts)
eventBus.publish(Log(bakeId, bakeLog))
nextLogNumber += 1
case PackerOutputParser.AmiCreated(amiId) =>
eventBus.publish(AmiCreated(bakeId, amiId))
}
processNextLine(process, reader, bakeId, eventBus, nextLogNumber)
}
// if line is null it means the stream has closed, so stop recursing and return
}