Skip to content

Fix terminal instantly quitting by clamping initial POSIX terminal pty dimensions#313698

Open
kangarko wants to merge 1 commit intomicrosoft:mainfrom
kangarko:fix-terminal-initial-dimensions
Open

Fix terminal instantly quitting by clamping initial POSIX terminal pty dimensions#313698
kangarko wants to merge 1 commit intomicrosoft:mainfrom
kangarko:fix-terminal-initial-dimensions

Conversation

@kangarko
Copy link
Copy Markdown

@kangarko kangarko commented May 1, 2026

Fixes #313694
Relates to #313693

This clamps the initial pty dimensions passed to node pty on non Windows platforms.

TerminalProcess.resize() already clamps cols and rows to at least 1, but the initial spawn options still receive the constructor values directly. In the macOS arm64 Insiders regression, the terminal process can become ready, immediately hit a resize path with ioctl(2) failed, EBADF, and exit before the shell starts.

This keeps Windows startup behavior unchanged, including the existing Git Bash delayed resize path, and only normalizes the POSIX spawn options.

Validation I ran locally on the affected Insiders install:

  • Integrated terminal starts and stays open
  • stty size and tty return valid output
  • nested zsh launches
  • nonzero command exit does not kill the terminal
  • interactive Python REPL accepts input through the pty
  • output polling and terminal cleanup paths work
  • large Unicode output plus stderr worked

I also made a separate user side workaround script for people stuck on the broken Insiders build, but that is intentionally not part of this PR.

Copilot AI review requested due to automatic review settings May 1, 2026 09:44
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@anthonykim1

Matched files:

  • src/vs/platform/terminal/node/terminalProcess.ts

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Clamps the initial PTY dimensions passed to node-pty on non-Windows platforms to avoid spawning a PTY with invalid cols/rows (eg 0x0) which can trigger early ioctl(2) failed, EBADF failures and cause the integrated terminal to exit immediately (notably on macOS arm64 Insiders).

Changes:

  • Clamp initial cols and rows to at least 1 for POSIX PTY spawn options.
  • Preserve Windows behavior (including the existing Git Bash delayed-resize path that relies on 0x0).

@kangarko kangarko changed the title Clamp initial POSIX terminal pty dimensions Fix terminal instantly quitting by clamping initial POSIX terminal pty dimensions May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrated terminal exits immediately in Insiders 43d0ed on macOS arm64

3 participants