Actually looking at the handle usages expose to JS, ex: innerPidHandle, handle etc they are only used for internal implementation. I would suggest to remove them from being exposed to JS and operate on pid values instead, on the native side extract the handle when needed using OpenProcess.
_Originally posted by @deepak1556 in https://github.com/microsoft/node-pty/pull/584#discussion_r1129001078_