Repository navigation
fix: rg hanging forever when run in bash, waiting for stdin - #3103
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where rg (ripgrep) and potentially other commands would hang indefinitely waiting for stdin input. The fix involves switching from exec to spawn and explicitly ignoring stdin by setting the stdio configuration.
- Replaced
execwithspawnfor better process control - Added
stdio: ["ignore", "pipe", "pipe"]to explicitly ignore stdin while preserving stdout and stderr pipes
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
rg hanging forever when run in bash, waiting for stdin
| @@ -146,9 +145,11 @@ export const BashTool = Tool.define("bash", { | |||
| }) | |||
| } | |||
|
|
|||
| const process = exec(params.command, { | |||
| const process = spawn(params.command, { | |||
| shell: 'bash', | |||
There was a problem hiding this comment.
will this break windows?
There was a problem hiding this comment.
It will work if the user has bash in PATH
I know Git for windows also installs Git Bash so we should use that if the user hasn't bash in path
This is what Claude Code does: if there is no global bash in Windows try to use C:\Program Files\Git\bin\bash.exe or the env variable CLAUDE_CODE_GIT_BASH_PATH
This should be done in a separate PR
There was a problem hiding this comment.
I think leaving it with just shell: true makes sense for now to avoid any breaking changes
There was a problem hiding this comment.
it preserves existing behavior and fixes issue
This reverts commit e205053190d2de9e879d913bba4348e46337ae61.
e205053 to
c71422a
Compare
rg hanging forever when run in bash, waiting for stdinrg hanging forever when run in bash, waiting for stdin
|
This is still an issue. File references cause opencode to use 100% of a core indefinitely, and the search will never return a result. Ripgrep work fine when run from the shell. |
|
That one is slightly different but we will check it out thank you for raising |
|
@jscheel can you confirm that you aren't working in a python project and that ripgrep is the actual issue? Because I have seen some issues like that specifically for python projects due to the lsp server |
|
Ah, definitely a Python project. Was assuming rg based on previous discord
conversations 😅
…On Mon, Oct 13, 2025 at 12:20 PM Aiden Cline ***@***.***> wrote:
*rekram1-node* left a comment (anomalyco/opencode#3103)
<#3103 (comment)>
@jscheel <https://github.com/jscheel> can you confirm that you aren't
working in a python project and that ripgrep is the actual issue?
Because I have seen some issues like that specifically for python projects
due to the lsp server
—
Reply to this email directly, view it on GitHub
<#3103 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABTUFQUMWPQZPE3F5L55BD3XPNM7AVCNFSM6AAAAACI5PM5ECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGOJYGQYTMNZRHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@jscheel to fix this add the following to your opencode.json (long term we need to fix something but for short term usability this may be good): |
|
@rekram1-node 🫡 will give it a try. Thanks! I can help debug anything if necessary. |
|
@rekram1-node let's just disable LSP by default. It causes so many opencode issues and it must already have churned so many users. I am able to use opencode just because I disabled it |
|
@remorses hm ultimately the decision isn't up to me but at my previous job I literally couldn't get an agent to write good java (in sufficiently large codebase) without the lsp feedback it would always have some error but I get what your point is I saw the change my mind in discord too haha |
|
The lsp is incredibly valuable. I’m not sure the answer is to just disable
it. Do we know what the issue is that causes it to hang in Python so badly?
…On Mon, Oct 13, 2025 at 2:23 PM Aiden Cline ***@***.***> wrote:
*rekram1-node* left a comment (anomalyco/opencode#3103)
<#3103 (comment)>
@remorses <https://github.com/remorses> hm ultimately the decision isn't
up to me but at my previous job I literally couldn't get an agent to write
good java (in sufficiently large codebase) without the lsp feedback it
would always have some error
but I get what your point is I saw the change my mind in discord too haha
—
Reply to this email directly, view it on GitHub
<#3103 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABTUFQYNL5KYYV6BE735SL3XP325AVCNFSM6AAAAACI5PM5ECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGOJYG43TCNZUGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@jscheel if you try the latest version this has been fixed, you should be able to remove that disable now |
|
@rekram1-node hah, love it. Bumping to 0.15.1 now, will give it a run. |
…yco#3103) Co-authored-by: Aiden Cline <[email protected]>
…yco#3103) Co-authored-by: Aiden Cline <[email protected]>
…yco#3103) Co-authored-by: Aiden Cline <[email protected]>
Pass ignore to stdin so that rg does not wait for stdin input. This probably fixes other commands hanging
Fix #3089