Skip to content

fix(pty): kill all PTYs on will-quit to prevent MSVC assertion crash#51

Merged
amirlehmam merged 1 commit into
amirlehmam:masterfrom
schroldgames:fix/pty-quit-crash
Jun 20, 2026
Merged

fix(pty): kill all PTYs on will-quit to prevent MSVC assertion crash#51
amirlehmam merged 1 commit into
amirlehmam:masterfrom
schroldgames:fix/pty-quit-crash

Conversation

@schroldgames

Copy link
Copy Markdown
Contributor

Fixes #50.

Problem

The will-quit handler tears down ancillary services but never calls ptyManager.killAll(). When Electron exits with PTY processes still live, node-pty's libuv async handles (batons) are pending as the runtime tears down, triggering:

Assertion failed! Expression: remove_pty_baton(baton->id)

Fix

One line — call ptyManager.killAll() first in will-quit:

app.on('will-quit', () => {
  ptyManager.killAll();
  pipeServer.stop();
  // ...
});

🤖 Generated with Claude Code

When wmux closes without explicitly killing PTY processes, node-pty's
libuv async handles (batons) are still pending as the process tears
down, triggering:

  Assertion failed! Expression: remove_pty_baton(baton->id)

Add ptyManager.killAll() as the first step in the will-quit handler so
node-pty can complete its cleanup before any other shutdown runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@amirlehmam amirlehmam merged commit 006f14e into amirlehmam:master Jun 20, 2026
@amirlehmam

Copy link
Copy Markdown
Owner

Merged and shipped in v0.8.8 🚀 Thanks @schroldgames! One-line, high-value — ptyManager.killAll() is now the first thing will-quit does, ahead of the rest of the teardown, so the remove_pty_baton assertion (#50) is gone.

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.

bug(pty): MSVC assertion crash on close — remove_pty_baton(baton->id)

2 participants