mirror of https://github.com/sbt/sbt.git
Merge pull request #6073 from eatkins/fix-console-cancellation
Fix console task cancellation
This commit is contained in:
commit
ac6c962a63
|
|
@ -457,7 +457,7 @@ object Terminal {
|
||||||
extends SimpleInputStream
|
extends SimpleInputStream
|
||||||
with AutoCloseable {
|
with AutoCloseable {
|
||||||
private[this] val isRaw = new AtomicBoolean(false)
|
private[this] val isRaw = new AtomicBoolean(false)
|
||||||
final def write(bytes: Int*): Unit = readThread.synchronized {
|
final def write(bytes: Int*): Unit = buffer.synchronized {
|
||||||
bytes.foreach(b => buffer.put(b))
|
bytes.foreach(b => buffer.put(b))
|
||||||
}
|
}
|
||||||
def setRawMode(toggle: Boolean): Unit = {
|
def setRawMode(toggle: Boolean): Unit = {
|
||||||
|
|
@ -488,7 +488,7 @@ object Terminal {
|
||||||
@tailrec def impl(): Unit = {
|
@tailrec def impl(): Unit = {
|
||||||
val _ = readQueue.take
|
val _ = readQueue.take
|
||||||
val b = in.read
|
val b = in.read
|
||||||
buffer.put(b)
|
buffer.synchronized(buffer.put(b))
|
||||||
if (Thread.interrupted() || (b == -1 && isRaw.get)) closed.set(true)
|
if (Thread.interrupted() || (b == -1 && isRaw.get)) closed.set(true)
|
||||||
else impl()
|
else impl()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue