Run blocking/long running shell commands in background
Describe the bug
I got gemini to write some code and then I was like "ok lets commit". Forgetting that I have gpg-agent and a provider set up for GPG so that I can sign commits with a yubikey. When it tried to commit gemini didn't know what to do, kept using tokens, and was very difficult to stop.
If you have your gpg-agent provider set to tty gemini receives a password prompt and doesn't give shell access to the user. For situations like this, or even sudo it would be nice if gemini could handle this nicely by giving you the ability to type into the shell command that is running.
Additional context
Diagnostic Information
- CLI Version: 0.1.1
- Git Commit: N/A
- Operating System: linux v22.16.0
- Sandbox Environment: no sandbox
- Model Version: gemini-2.5-pro
- Memory Usage: 177.7 MB
Relevant internal bug: b/425804301 (run shell commands in a non-interactive tty)
Duped another relevant issue where npm run dev hangs. It's not waiting for user input from the TTY but it is similar in concept (starting a web server)
From closed dupe on hang of npm run dev:
Yeah. I was able to resolve. I had to change the version of tailwindcss to 3.4.17. Post that gemini was able to start the server.
any workarounds for temporary guys? 😅
From #3732:
Models running npm tests fail nearly 100% of the time from capturing the result of the test, instead they run indefinitely (I've left for 2 hours)
does anyone found a workaround?
does anyone found a workaround? Just try this ✌️
same, it will be lovely if it auto detects the commands and run it in the background.
it seems it also does not react to new message.
did anyone find a workaround for this . claude code handles this really well by providing a option to send the shell to background task ( via ctrl+b ) and read the shell output.
did anyone find a workaround for this . claude code handles this really well by providing a option to send the shell to background task ( via ctrl+b ) and read the shell output.
yes, use claude code
We now have support for interactive shell commands
You can use Ctrl+f to focus on shell commands that need are interactive and require input.
Going to update the title of this bug to now reflect the second ask which is adding support to run blocking or long running shell commands in the background. 👍
We now have support for interactive shell commands You can use
Ctrl+fto focus on shell commands that need are interactive and require input.Going to update the title of this bug to now reflect the second ask which is adding support to run blocking or long running shell commands in the background. 👍
@jackwotherspoon Ctrl+f is not optimal its also the default to search stuff in vscode terminal which is not letting me use the interactive terminal in gemini please use something different or give us an option to set that
@jackwotherspoon I want to make another point here. That in my previous try, not only npm run dev failed. But also node server.js
Which means, if an error was raised but no information on that error. Like no console.log() to explicitly print out the error. The Gemini will also stuck.
Since you merge issue here. I hope this problem can be addressed too, to avoid further debug.
Let's say I run a flutter app. I want to keep the terminal open and in the background for the AI to keep in context.
As people mentioned before, this issue pretty much makes gemini cli almost unusable.
My workaround was to ask it run services with nohup or setsid and dump the logs and look at the logs, but this ends up the agent getting stuck in restarting services loops when it needs to do so.
Any coding feedback loop will require the ability of the agent to work with an interactive shell making it probably the most crucial feature you guys might want to have a look to make this CLI agent work.
I think this is the real game changer feature that Claude code provides in the space. EDIT: forgot to mention an important bit. Interactive shell for user input must be a secondary option. The main option should be the background process. I say this cause you did implement this feature, it should definitely take a backseat to the more important functionality of background shell or it can end up still getting the agent stuck. Unless maybe you wanna run Gemini cli as a sys admin helper or something
I do realize good work went into the interactive shell bit, but it's not functional to solve this problems
This is a feature request for the agent to run blocking commands in the background. The reported CLI version 0.1.1 is very old, so it needs retesting.
The reported CLI version 0.1.1 is very old, so it needs retesting.
It's still actual on version 0.42.0.
Please, this feature will be a game changer
This report describes a bug where the agent hangs during interactive shell commands like GPG signing. Since this was reported on a very old version (0.1.1), please verify if this issue persists in the latest version (0.44.0).