Fix empty command bug (#3139)

This commit is contained in:
Chris Estreich 2025-05-02 19:52:11 -07:00 committed by GitHub
parent dd3cd7fd7d
commit 5bca10d73c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"roo-cline": patch
---
Fix empty command bug

View file

@ -27,7 +27,7 @@ export const CommandExecution = ({ executionId, text }: CommandExecutionProps) =
const [status, setStatus] = useState<CommandExecutionStatus | null>(null)
const [output, setOutput] = useState("")
const [command, setCommand] = useState("")
const [command, setCommand] = useState(text)
const lines = useMemo(
() => [`$ ${command}`, ...output.split("\n").filter((line) => line.trim() !== "")],
@ -79,7 +79,9 @@ export const CommandExecution = ({ executionId, text }: CommandExecutionProps) =
if (!status && text) {
const index = text.indexOf(COMMAND_OUTPUT_STRING)
if (index !== -1) {
if (index === -1) {
setCommand(text)
} else {
setCommand(text.slice(0, index))
setOutput(text.slice(index + COMMAND_OUTPUT_STRING.length))
}