[BUG] Terminal tool gets stuck after exit code

This is happening to me too. Im on windows, using cursor 1.0 and oh-my-posh, the default theme, no extra changes on the vscode settings

Just switch to Copilot, it has zero issues with terminal output

2 Likes

This is what’s happening to me.

I don’t know why these escape sequences just got added in to bash.

I just updated my .zshrc and added this at the top to make my setup simpler when it’s triggered from Cursor.

# ============================================================================
# 🚨 CURSOR/IDE DETECTION - MUST BE FIRST
# ============================================================================
# If running in Cursor or VS Code, use minimal shell and skip fancy features
if [[ $TERM_PROGRAM == "vscode" ]] || [[ $CURSOR_SESSION == "1" ]] || [[ -n $CURSOR_TRACE_ID ]]; then
    # Ultra-minimal shell for IDE integration
    export PS1='$ '
    export PS2=''
    
    # Essential paths
    export PATH=$HOME/bin:/usr/local/bin:$PATH
    export PATH=/opt/homebrew/bin:$PATH
    export PATH=/Users/rhaenyra/.local/bin:$PATH
    export EDITOR="/opt/homebrew/bin/micro"
    
    # Load essential tools (add your tools here)
    export NVM_DIR="$HOME/.nvm"
    [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
    
    return  # Exit early, skip all fancy shell features
fi

Basically, I removed oh my zsh and theming when running from Cursor and it just works. Everything stays the same elsewhere.

1 Like

I think it’s theme that cause the issue. I removed the p10k theming and this issue solved. It works fine now even if I still source oh-my-zsh.sh

Appreciate!

Still having this problem on Mac. Can’t find anything that works :confused:

I turned this into a User Rule:

To reduce hangs, ALWAYS run `powerlevel10k_plugin_unload; unset PROMPT RPROMPT RPS1 RPS2; PS1='%n@%m:%~%# '` in the first terminal before any running any command.

This almost works, but the hang is still encountered when Cursor first runs this command at the start. After that though it works fine.

Of course this doesn’t work… now Cursor is suggesting the above Cursor Rule over actual commands it’s trying to suggest :joy: :melting_face: :sob:

1 Like

same I feel like I spend more time killing have to get the terminal commands to exit

Same here, it’s really annoying :frowning: working in the terminal is sometimes just impossible..

Also, tried the fix @carlosrivera suggested - didn’t help

Same problem here using Windows Powershell. Spamming return inside the tool makes it continue though.

1 Like

Same problem here using Windows Powershell!!

1 Like

This is still a problem. Related fully described problem, with additional bugs:

same issue in windows powershell.
Only workaround i have found is to just spam returns into the terminal.

Absolutely most annoying issue with cursor right now.

1 Like

I ended up creating a few different hacks to at least mitigate this issue because the other solutions weren’t working for me (I’m in wsl2 not sure if that matters). But essentially I updated my .bashrc (was .zshrc before I reinstalled everything trying to fix this) to kill the terminal after set time periods and told the AI to specify a time period with each command using cursor rules. So for example the AI now runscursor_60s uv run pytest src/tests/unit/ -s -v or cursor_30s python3 src/tests/moto/setup_test_data.py etc.

If anyone is still experiencing this and wants my code let me know. Its a very old and annoying issue though surprised its not fixed for everyone already. Trying to figure out if this isn’t a problem for most people and I have some obscure issue where despite a very simplified shell setup (default ubuntu 24.04 under wsl2) it still hangs frequently enough to make cursor unusable without my mitigations, but quite tolerable with the mitigations (there are other mitigations in addition to the timeout).

Encountered the same issue in v1.4.5 on mac os

disabling auto replies helped me:

  1. replace terminal.integrated.autoReplies in settings.json:
    "terminal.integrated.autoReplies": {},
    "terminal.integrated.enableAutoReplies": false
  1. restart
  2. voilĂ 
1 Like

Hmm, interesting. I don’t see “terminal.integrated.enableAutoReplies” as a parameter at all in cursor. Still, trying the “terminal.integrated.autoReplies” workaround right now…

The problem is constantly being reproduced with Windows Powershell. Cursor version: 1.5.11. The problem is critical, as it does not allow you to leave the agent running and move away from the keyboard. Are there any solutions?

1 Like

I have the same problem since around May, 2025. In April, I remember the terminal worked fine, Then you’ve begun to “enhance“ it - so it was getting worse and worse with each Cursor Update. Now it totally ignores to determine whether the terminal has finished the output. I have to sit before the screen as a dummy monkey and press “Cancel“ on every terminal command run. It seems you find it funny to make monkey of you customers? Please fix this SIMPLE dam-ed bug.

Pull Request:
terminal.run(terminalCommand);
long lastSize = 0;
int timePassed = 0;
do {
while (timePassed < settings.terminalActivityTimeout) {
Thread.sleep(1000);
timePassed++;
int currentSize = terminal.getOutput.size();
if (currentSize != lastSize) {
lastSize = currentSize;
timePassed = 0; // Reset the timeout on activity
}
}
}
while (timePassed < settings.terminalActivityTimeout);
finishTerminalSuccessfully();


Version: 1.6.26 (user setup)
VSCode Version: 1.99.3
Commit: 6af2d906e8ca91654dd7c4224a73ef17900ad730
Date: 2025-09-16T17:12:31.697Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26100