summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/shellCommandProcessor.ts
diff options
context:
space:
mode:
authorOlcan <[email protected]>2025-05-01 13:41:00 -0700
committerGitHub <[email protected]>2025-05-01 20:41:00 +0000
commitca53565240174eebbe0c03457a8444cae81e2747 (patch)
treed8779e4084eff28f603c71675e6e6a2ebe0d74d0 /packages/cli/src/ui/hooks/shellCommandProcessor.ts
parenta386841947423dcf7d86f2e7f5d72849c95aa5a2 (diff)
prevent crash on empty shell cmd with $ or ! (#240)
Diffstat (limited to 'packages/cli/src/ui/hooks/shellCommandProcessor.ts')
-rw-r--r--packages/cli/src/ui/hooks/shellCommandProcessor.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/cli/src/ui/hooks/shellCommandProcessor.ts b/packages/cli/src/ui/hooks/shellCommandProcessor.ts
index 300f21fe..d716183d 100644
--- a/packages/cli/src/ui/hooks/shellCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/shellCommandProcessor.ts
@@ -41,7 +41,12 @@ export const useShellCommandProcessor = (
return false;
}
// Remove symbol from rawQuery
- const trimmed = rawQuery.trim().slice(1);
+ const trimmed = rawQuery.trim().slice(1).trimStart();
+
+ // Stop if command is empty
+ if (!trimmed) {
+ return false;
+ }
// Add user message *before* execution starts
const userMessageTimestamp = Date.now();