Skip to content

Ctrl-C doesn't clear the input on Windows, it crashes #10538

Closed

Description

@tnglemongrass

Description

Description

On Windows 11, built-in Terminal App:

  1. launch opencode.cmd
  2. type 'hello' (without sending)
  3. press Ctrl-C

Expected:

  • clears the input, opencode still running

Actual:

  • the app crashes, user is thrown back to powershell prompt, mouse movements produce strange ANSI-characters

Interesting:

  • Ctrl-D and /exit work fine
  • Ctrl-C within the first second works fine, too
  • The following fix helps, as starting point (probably breaks other functionality):
--- a/packages/opencode/src/cli/cmd/tui/thread.ts
+++ b/packages/opencode/src/cli/cmd/tui/thread.ts
@@ -156,9 +156,9 @@ export const TuiThreadCommand = cmd({
       },
     })

-    setTimeout(() => {
-      client.call("checkUpgrade", { directory: cwd }).catch(() => {})
-    }, 1000)
+    // setTimeout(() => {
+    //   client.call("checkUpgrade", { directory: cwd }).catch(() => {})
+    // }, 1000)

     await tuiPromise
   },

Plugins

none

OpenCode version

latest dev branch:

commit d6c5ddd6dc835c4d0a3118350b92d7a9d03d7f22 (origin/dev, origin/HEAD, dev)
Author: GitHub Action <action@github.com>
Date:   Fri Jan 23 12:05:37 2026 +0000

    ignore: update download stats 2026-01-23

Steps to reproduce

see above

Screenshot and/or share link

none

Operating System

Windows 11

Terminal

Built-In Windows Terminal App

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 25, 2026
  2. github-actions commented on Jan 25, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  3. InCerryGit commented on Jan 26, 2026

    @InCerryGit

    same issue

  4. tnglemongrass commented on Jan 27, 2026

    @tnglemongrass
    Author

    Digging further, this is caused by how external commands are launched in /packages/opencode/src/installation/index.ts (via Bun Shell). Migrating to Bun Spawn seems to fix the issue for me:

    From

            $`npm list -g --depth=0`.throws(false).quiet().text(),
    

    To

          Bun.spawn(["npm", "list", "-g", "--depth=0"])
    

    plus some try/catch and stdout handling to mimick throws(false).quiet().text() (it's needed for all occurrences in that file).

    Some remarks:

    • Unclear why the one approach works and the other not.
    • These are only short-running processes. Why do they break ctrl-c permanently?
    • There are more files that import { $ }, but only the above file seems to produce the issue. At least, after using the bash tool and the !-prompt, ctrl-c still works fine.
    • As a user, I tried to disable auto-updates via config, but version check logic runs always. Would be nice to have this "as workaround".

    The bug exists at least since v1.0.0 (3 months ago), and severely affects Windows users. So even a providing a functional workaround (disable auto-updates) would be a big step forward.

  5. Hona commented on Feb 12, 2026

    @Hona
    Member

    this is fixed as of 1.1.60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentuiwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions