# Terminal Command Tool Prematurely Reports Completion

**URL:** <https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941>\
**Category:** Bug Reports\
**Created:** [July 29, 2025, 6:19pm UTC](https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941 "2025-07-29T18:19:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parvesh\_Jain](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/parvesh_jain/32/68257_2.png) [@Parvesh\_Jain](https://forum.cursor.com/u/Parvesh_Jain)\
**Post date:** [July 29, 2025, 6:19pm UTC](https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941/1 "2025-07-29T18:19:17Z")

</div>

### Describe the Bug

The run\_terminal\_cmd tool in Cursor’s AI assistant incorrectly reports command completion for long-running processes before they actually finish executing.

Environment

Cursor Version: 1.3.4  
OS: macOS Darwin 24.5.0  
Shell: /opt/homebrew/bin/zsh  
AI Model: Claude Sonnet 4

Problem Description

When using the run\_terminal\_cmd tool for long-running commands (especially build commands like ./gradlew build), the tool returns and reports “Command completed” prematurely while the command is still executing in the terminal.

### Steps to Reproduce

Use AI assistant with run\_terminal\_cmd tool  
Execute a long-running command like ./gradlew build in a large project  
Observe that the tool returns immediately with just the shell prompt  
Check actual terminal - command is still running and producing output

### Expected Behavior

The run\_terminal\_cmd tool should:  
Wait for the actual command to complete  
Return the full command output (compilation logs, test results, etc.)  
Only report “Command completed” when the process actually finishes  
Show proper exit codes and full output

### Operating System

MacOS

### Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.3.4 (Universal)  
VSCode Version: 1.99.3  
Commit: bfb7c44bcb74430be0a6dd5edf885489879f2a20  
Date: 2025-07-29T03:47:21.131Z  
Electron: 34.5.1  
Chromium: 132.0.6834.210  
Node.js: 20.19.0  
V8: 13.2.152.41-electron.0  
OS: Darwin arm64 24.5.0

### Additional Information

Actual Behavior  
The tool:  
Returns prematurely with only shell prompt: ➜ my-project git:(feature-branch) ✗  
Reports “Command completed” while command is still running  
Provides no actual command output or results  
Causes AI assistant to incorrectly assume command finished

Evidence/Examples  
Working Example (shorter command):

> ./gradlew :my-app:test --tests “_SampleControllerTest_”  
> Returns full output including:  
> Task :my-app:test  
> Gradle Test Run :my-app:test  
> [… full test output …]  
> BUILD SUCCESSFUL in 5s

Broken Example (long-running command):

> ./gradlew build  
> Returns immediately with only:  
> ➜ my-project git:(feature-branch) ✗  
> (No build output, still running in actual terminal)

Impact  
AI assistant makes incorrect assumptions about command completion  
May attempt to run subsequent commands while builds are still in progress  
Breaks automated workflows that depend on build results  
Causes confusion and potential race conditions

Suggested Fix  
The run\_terminal\_cmd tool should properly wait for process completion by:  
Monitoring actual process exit status  
Collecting complete stdout/stderr output  
Only returning when the spawned process actually terminates  
Workaround  
Currently requires manual verification that commands have actually completed before proceeding with AI assistant recommendations.

### Does this stop you from using Cursor

Yes - Cursor is unusable

---

<div class="post-metadata">

**Author:** ![tiz.io](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@tiz.io](https://forum.cursor.com/u/tiz.io)\
**Post date:** [July 29, 2025, 8:33pm UTC](https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941/2 "2025-07-29T20:33:22Z")

</div>

This appears to be similar to [this issue](https://forum.cursor.com/t/yolo-cancelling-commands-too-quickly/36527). If you interrogate the agent, they have no idea why the command returned too soon and will sometimes blame the user for the premature exit. Turns out there is another model or system that is monitoring terminal commands and reporting when they are “done”. But depending on which shell you are using or what other things are happening in that terminal, the command exit detection can fire prematurely or not at all. I find that if the agent is running any command that takes more than 5 seconds, there’s a very high chance the IDE will ^C and kill it. If it does let the command complete, it will often just sit there until the connection to the agent service times out.

The terminal command tool needs some very important fixes.

---

<div class="post-metadata">

**Author:** ![Parvesh\_Jain](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/parvesh_jain/32/68257_2.png) [@Parvesh\_Jain](https://forum.cursor.com/u/Parvesh_Jain)\
**Post date:** [July 29, 2025, 8:56pm UTC](https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941/3 "2025-07-29T20:56:34Z")

</div>

> [@tiz.io](#):
>
> epending on which shell you are using or what other things are happening in that terminal, the command exit detection can fire prematurely or not at all. I find that if the agent is running any command that takes more than 5 seconds, there’s a very high chance the IDE will ^C and kill it. If it does let the command complete, it will often just sit there until the connection to the agent se

thanks @tiz.io for sharing this. Are there any workarounds you know of ?

---

<div class="post-metadata">

**Author:** ![tiz.io](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@tiz.io](https://forum.cursor.com/u/tiz.io)\
**Post date:** [July 29, 2025, 9:09pm UTC](https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941/4 "2025-07-29T21:09:45Z")

</div>

I’ve tried a few that get me through the day:

Sometimes I wrap critical commands that I run often (like unit tests) in a nohup or script that rejects `^C`.

I’ve also made some commands in the background and pipe their output to a log file which I then share back to the agent.

These are all janky hacks and make me want to either create my own CLI MCP or find a different IDE until this is fixed.

The process detection logic Cursor uses right now is just incomplete. The agent’s CLI tool needs to have configurable string monitoring for command completion. It needs to be able to handle long-running commands, shell-wrapping environments (like conda), and interactive CLI applications (like `git commit`, a REPL, or a mysql cli).

---

<div class="post-metadata">

**Author:** ![condor](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/condor/32/73148_2.png) [@condor](https://forum.cursor.com/u/condor)\
**Post date:** [July 30, 2025, 7:52am UTC](https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941/5 "2025-07-30T07:52:55Z")

</div>

hi @Parvesh_Jain and thank you for the bug report.

Please update to 1.3.5 and let me know if the same issue still happens.  
We have deployed bug fixes for several cases but if this one persists more info may be necessary:

- Could you post a Request ID with privacy disabled so we can look into the details? [Cursor – Getting a Request ID](https://docs.cursor.com/troubleshooting/request-reporting)
- Please share errors from `Help > Toggle Developer Tools > Console`
- Have a look also at Logs in `Command Palette > Open Logs Folder` and post any errors here.

@tiz.io could you also check and share details? While it seems similar from usage, the cause is different in this case.

---

<div class="post-metadata">

**Author:** ![Parvesh\_Jain](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/parvesh_jain/32/68257_2.png) [@Parvesh\_Jain](https://forum.cursor.com/u/Parvesh_Jain)\
**Post date:** [August 4, 2025, 5:37pm UTC](https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941/6 "2025-08-04T17:37:39Z")

</div>

Thanks @condor , the update helped, and I am not seeing premature exits from cursor in last couple of days atleast.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [August 26, 2025, 5:38pm UTC](https://forum.cursor.com/t/terminal-command-tool-prematurely-reports-completion/123941/7 "2025-08-26T17:38:07Z")

</div>

Closed on August 26, 2025, 5:38pm UTC

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.
