Allow windows console users to exit with ctrl+c

On windows with jline3, inputting ctrl+c in the sbt console just causes
the input stream to return -3 unlike mac and linux where ctrl+c always
signals.

Fixes https://github.com/sbt/sbt/issues/5791
This commit is contained in:
Ethan Atkins 2020-08-23 08:54:45 -07:00
parent 99e833d11a
commit af761da811
1 changed files with 6 additions and 3 deletions

View File

@ -108,9 +108,12 @@ private[sbt] object JLine3 {
}
case _ => throw new ClosedException
}
if (res == 4 && term.prompt.render().endsWith(term.prompt.mkPrompt()))
throw new ClosedException
res
res match {
case 3 /* ctrl+c */ => throw new ClosedException
case 4 /* ctrl+d */ if term.prompt.render().endsWith(term.prompt.mkPrompt()) =>
throw new ClosedException
case r => r
}
}
}
override val output: OutputStream = new OutputStream {