Fix for previous - don't call callback synchronously

This commit is contained in:
Joshua Bell 2024-02-10 18:28:31 -08:00
parent 555f8de2ae
commit a23879b693
1 changed files with 3 additions and 3 deletions

6
dos.js
View File

@ -587,15 +587,15 @@ function DOS(tty) {
tty.writeString(prompt); // TODO: Correct? Newline? tty.writeString(prompt); // TODO: Correct? Newline?
var tmp = clockbuf; var tmp = clockbuf;
clockbuf = ''; clockbuf = '';
callback(tmp); setTimeout(function() { callback(tmp); }, 0);
} }
function clock_readChar(callback) { function clock_readChar(callback) {
if (!clockbuf.length) { if (!clockbuf.length) {
callback('\r'); setTimeout(function() { callback('\r'); }, 0);
} else { } else {
var c = clockbuf.substring(0, 1); var c = clockbuf.substring(0, 1);
clockbuf = clockbuf.slice(1); clockbuf = clockbuf.slice(1);
callback(c); setTimeout(function() { callback(c); }, 0);
} }
} }
} }