feature: Adds ctrl + c support.
This commit is contained in:
parent
f7a6a4356d
commit
c5c73ae602
1 changed files with 4 additions and 1 deletions
|
@ -21,7 +21,10 @@ export async function readFromKeyboard(
|
|||
const readStreamData = stream.read();
|
||||
if (readStreamData == null) return setTimeout(eventLoop, pullRate);
|
||||
|
||||
if (readStreamData.includes("\r") || readStreamData.includes("\n")) {
|
||||
if (readStreamData.includes("\x03")) {
|
||||
stream.write("^C");
|
||||
return promise("");
|
||||
} else if (readStreamData.includes("\r") || readStreamData.includes("\n")) {
|
||||
return promise(line.replace("\r", ""));
|
||||
} else if (readStreamData.includes(clientBackspace)) {
|
||||
if (line.length == 0) return setTimeout(eventLoop, pullRate); // Here because if we do it in the parent if statement, shit breaks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue