diff options
| author | Olcan <[email protected]> | 2025-05-01 13:41:00 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-01 20:41:00 +0000 |
| commit | ca53565240174eebbe0c03457a8444cae81e2747 (patch) | |
| tree | d8779e4084eff28f603c71675e6e6a2ebe0d74d0 /packages/cli/src/ui/hooks/shellCommandProcessor.ts | |
| parent | a386841947423dcf7d86f2e7f5d72849c95aa5a2 (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.ts | 7 |
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(); |
