Merge pull request #6965 from eed3si9n/wip/available

Fix proxyInputStream#available
This commit is contained in:
eugene yokota 2022-07-10 05:01:47 -04:00 committed by GitHub
commit d096e716d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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