microsoft / node-pty

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

Process HANDLE leak on windows #513

Closed xhcoding closed 2 years ago

xhcoding commented 2 years ago

Environment details

Issue description

var os = require('os');
var pty = require('node-pty');

var shell = os.platform() === 'win32' ? 'powershell' : 'bash';

setInterval(() => {

  console.log("spawn new process");
  var ptyProcess = pty.spawn(shell, [], {
    name: 'xterm-color',
    cols: 80,
    rows: 30
  });

  ptyProcess.kill();

}, 5000);

After the above code runs for a few minutes :

16390417046148
Tyriar commented 2 years ago

Should be fixed in https://github.com/microsoft/node-pty/pull/510