fix(terminal): enhance fallback command detection for quit commands
This commit is contained in:
1 parent
f4f6f6a4bb
commit
4ff29e5009
2 files changed
+5
-1
No files matched your search
@@ -167,5 +167,7 @@ describe("fallback command detection", () => {
|
||||
expect(nextFallbackInteractiveState(true, "\x04", "")).toBe(false);
|
||||
expect(nextFallbackInteractiveState(false, "\r", "ls")).toBe(false);
|
||||
expect(nextFallbackInteractiveState(true, "\r", "exit()")).toBe(false);
|
||||
expect(nextFallbackInteractiveState(true, "\r", "\\q")).toBe(false);
|
||||
expect(nextFallbackInteractiveState(true, "\r", ".quit")).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -15,7 +15,9 @@ export function nextFallbackInteractiveState(
|
||||
if (data === "\x04") return false;
|
||||
if (data !== "\r" || !command) return interactive;
|
||||
if (startsObviousInteractiveSession(command)) return true;
|
||||
if (/^(?:exit|quit|\.exit)(?:\(\))?$/iu.test(command.trim())) return false;
|
||||
if (/^(?:(?:exit|quit)(?:\(\))?|\.exit|\.quit|\\q)$/iu.test(command.trim())) {
|
||||
return false;
|
||||
}
|
||||
return interactive;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user