Fix proxyInputStream#available

proxyInputStream does not override available,
which broke sbt-site previewSite.
This fixes that.
This commit is contained in:
Eugene Yokota 2022-07-10 04:35:57 -04:00
parent 7dc4378fdf
commit 2462d5fbcf
1 changed files with 8 additions and 1 deletions

View File

@ -675,7 +675,7 @@ object Terminal {
} }
override def close(): Unit = if (running.compareAndSet(true, false)) this.interrupt() override def close(): Unit = if (running.compareAndSet(true, false)) this.interrupt()
} }
def read(): Int = { override def read(): Int = {
if (isScripted) -1 if (isScripted) -1
else if (bootInputStreamHolder.get == null) activeTerminal.get().inputStream.read() else if (bootInputStreamHolder.get == null) activeTerminal.get().inputStream.read()
else { else {
@ -689,6 +689,13 @@ object Terminal {
poll() poll()
} }
} }
override def available(): Int =
if (isScripted) 0
else
bootInputStreamHolder.get match {
case null => activeTerminal.get().inputStream.available()
case stream => stream.available() + activeTerminal.get().inputStream.available()
}
} }
private[this] object proxyOutputStream extends OutputStream { private[this] object proxyOutputStream extends OutputStream {
private[this] def os: OutputStream = activeTerminal.get().outputStream private[this] def os: OutputStream = activeTerminal.get().outputStream