-
Notifications
You must be signed in to change notification settings - Fork 959
Open
Description
Description
When opencode executes a command that requires a sudo password, the application becomes unresponsive and hangs indefinitely.
Root Cause
The bash tool in packages/opencode/src/tool/bash.ts
spawns processes without stdin connected:
const process = Bun.spawn({
cmd: ["bash", "-c", params.command],
cwd: App.info().path.cwd,
maxBuffer: MAX_OUTPUT_LENGTH,
signal: ctx.abort,
timeout: timeout,
stdout: "pipe",
stderr: "pipe",
// stdin is not specified, defaults to null/closed
})
When a sudo command is executed, it waits for password input that can never be provided, causing the process to hang until the timeout (default 1 minute).
Expected Behavior
- Detect commands that require sudo
- Either:
- Provide a clear error message explaining that sudo commands are not supported
- Or implement a mechanism to handle password prompts safely
Steps to Reproduce
- Ask opencode to run any command requiring sudo (e.g.,
sudo apt update
) - The app becomes unresponsive while waiting for the password prompt that can't be answered
Proposed Solution
Add detection for sudo commands and provide appropriate error handling before execution.
maxolasersquad
Metadata
Metadata
Assignees
Labels
No labels