Environment
- wmux: v0.8.7
- Windows (any)
Behavior
When closing wmux, a Microsoft Visual C++ Runtime Library dialog appears:
Assertion failed!
Program: ...wmux.exe
File: ...
Expression: remove_pty_baton(baton->id)
The crash is intermittent — more likely when multiple terminal panes are open.
Root cause
The will-quit handler stops ancillary services (pipe server, CDP proxy, port scanner, pollers) but never explicitly kills the PTY processes:
app.on('will-quit', () => {
pipeServer.stop();
cdpProxy.stop();
portScanner.stop();
gitPoller.unwatchAll();
prPoller.stopAll();
// ← ptyManager.killAll() missing
});
When Electron exits without calling ptyManager.killAll(), node-pty's libuv async handles (called "batons") are still pending as the Node.js runtime tears down. The remove_pty_baton assertion fires because node-pty attempts to clean up those handles in a partially-destroyed state.
Fix
Call ptyManager.killAll() as the first step in the will-quit handler, before any other teardown runs. This gives node-pty time to complete its cleanup before the process exits.
app.on('will-quit', () => {
ptyManager.killAll(); // ← add this
pipeServer.stop();
// ...
});
Environment
Behavior
When closing wmux, a Microsoft Visual C++ Runtime Library dialog appears:
The crash is intermittent — more likely when multiple terminal panes are open.
Root cause
The
will-quithandler stops ancillary services (pipe server, CDP proxy, port scanner, pollers) but never explicitly kills the PTY processes:When Electron exits without calling
ptyManager.killAll(), node-pty's libuv async handles (called "batons") are still pending as the Node.js runtime tears down. Theremove_pty_batonassertion fires because node-pty attempts to clean up those handles in a partially-destroyed state.Fix
Call
ptyManager.killAll()as the first step in thewill-quithandler, before any other teardown runs. This gives node-pty time to complete its cleanup before the process exits.