mirror of https://github.com/sbt/sbt.git
avoid deadlock in ConsoleOut.systemOutOverwrite
System.out can be reset after being captured by `val lockObject`. Then locking `lockObject` and calling `println()` could lead to a deadlock.
This commit is contained in:
parent
b337f3d9ac
commit
dcc87bd246
|
|
@ -34,8 +34,8 @@ object ConsoleOut
|
|||
def println(): Unit = synchronized {
|
||||
val s = current.toString
|
||||
if(ConsoleLogger.formatEnabled && last.exists(lmsg => f(s, lmsg)))
|
||||
System.out.print(OverwriteLine)
|
||||
System.out.println(s)
|
||||
lockObject.print(OverwriteLine)
|
||||
lockObject.println(s)
|
||||
last = Some(s)
|
||||
current = new java.lang.StringBuffer
|
||||
}
|
||||
|
|
@ -59,4 +59,4 @@ object ConsoleOut
|
|||
def println(s: String) = { out.write(s); println() }
|
||||
def println() = { out.newLine(); out.flush() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue