mirror of
https://github.com/sbt/sbt.git
synced 2026-10-07 18:43:31 +02:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user