fixed CLI input problem and tetris sample

This commit is contained in:
sergeych committed 2026-05-10 13:00:08 +03:00
1 parent 31fac1a73c
commit 3e74019d9d
2 files changed
+5 -6

No files matched your search

+1 -6
View File
@@ -636,13 +636,10 @@ if (!Console.isSupported()) {
}
}
var inputRunning = true
launch {
while (inputRunning) {
while (true) {
try {
for (ev in Console.events()) {
if (!inputRunning) break
// Isolate per-event failures so one bad event does not unwind the stream.
try {
if (ev is ConsoleKeyEvent) {
@@ -675,7 +672,6 @@ if (!Console.isSupported()) {
}
} catch (err: Object) {
// Recover stream-level failures by recreating event stream in next loop turn.
if (!inputRunning) break
logError("Input stream recovered after error", err)
Console.setRawMode(true)
delay(50)
@@ -803,7 +799,6 @@ if (!Console.isSupported()) {
delay(FRAME_DELAY_MS)
}
} finally {
inputRunning = false
Console.setRawMode(false)
Console.setCursorVisible(true)
Console.leaveAltScreen()