microsoft / node-pty

Fork pseudoterminals in Node.JS
Other
1.46k stars 235 forks source link

Disconnect IO handles during PtyKill #510

Closed rzhao271 closed 2 years ago

rzhao271 commented 2 years ago

Ref https://github.com/microsoft/vscode/issues/123056

I noticed some handles were still being left open after killing a pwsh terminal in VS Code. This PR closes the hIn and hOut handles during PtyKill. I'm currently following the docs at https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-operations, which suggest that the server can call DisconnectNamedPipe, and then call CloseHandle after.

Note that this fix at most helps with some cleanup during PtyKill, but it doesn't solve anything regarding PtyConnect.

Before merging: