mirror of https://github.com/sbt/sbt.git
Hold lock while writing bytes to stdout
We should always hold the print stream lock when calling progressState.write because otherwise the task progress thread could concurrently write to stdout.
This commit is contained in:
parent
44a605198b
commit
e4cd6a38fc
|
|
@ -882,8 +882,9 @@ object Terminal {
|
|||
}
|
||||
override def flush(): Unit = combinedOutputStream.flush()
|
||||
}
|
||||
private def doWrite(bytes: Array[Byte]): Unit =
|
||||
progressState.write(TerminalImpl.this, bytes, rawPrintStream, hasProgress.get && !rawMode.get)
|
||||
private def doWrite(bytes: Array[Byte]): Unit = withPrintStream { ps =>
|
||||
progressState.write(TerminalImpl.this, bytes, ps, hasProgress.get && !rawMode.get)
|
||||
}
|
||||
override private[sbt] val printStream: PrintStream = new LinePrintStream(outputStream)
|
||||
override def inputStream: InputStream = writeableInputStream
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue