node-pty icon indicating copy to clipboard operation
node-pty copied to clipboard

Uninstall deferred event handlers after the pty is ready

Open Tyriar opened this issue 7 years ago • 1 comments

In WindowsTerminal there are ['connect', 'data', 'end', 'timeout', 'drain'] event listeners which handle event handler deferreds, we should uninstall these handlers after it's ready. This would reduce the amount of code that is run when a data event is triggered.

Tyriar avatar Aug 14 '18 22:08 Tyriar

@Tyriar Please reconsider also how you set the ready state ... now isReady is only set on the first data event, however I just had a case when no output data was send and the command just ends. So the 'exit' is fired without any data. This is a valid case.

However now you can't destroy the terminal or kill it, as the deferreds are still in place waiting for the ready state ... which never comes.

Maybe be also destroy and kill shouldn't really be using deferreds and just kill the whole thing. Or add a timeout parameter to destroy/kill anyway after a specific time - no matter if command is running.

gpetrov avatar Sep 07 '20 19:09 gpetrov