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

Expose an onClose event on Terminal

Open akosyakov opened this issue 5 years ago • 1 comments
trafficstars

In Node.js child_process module also provide close and exit events. There close means that all data were delivered and exit that the process exits. exit can happen before close, because child processes can use shared stdio streams: https://nodejs.org/api/child_process.html#child_process_event_close

Does it mean the same for node-pty? If not what would be the analogy instead?

akosyakov avatar Nov 21 '19 16:11 akosyakov

The API only exposes onExit and onData events, that's probably why sometimes not all data gets flushed when using exit so it's probably a good idea to add an onClose event following these semantics. See here:

https://github.com/microsoft/node-pty/blob/f3099ad49177197203b27e9450aef7c03530c375/src/terminal.ts#L95-L98

Tyriar avatar Nov 22 '19 17:11 Tyriar