From 45a8fb99e482a785212299903d1b9ff852215e9f Mon Sep 17 00:00:00 2001 From: rummik Date: Mon, 28 Nov 2016 01:46:22 -0500 Subject: [PATCH] Fix emitter.prependListener is not a function when piping from stdin This seems to be a requirement for use with Node 6+ and doing a `process.stdin.pipe()` (possibly previous versions as well, but I haven't checked) Found while updating jedi4ever/ttyrec.js dependencies for use with newer Node.js versions --- lib/pty.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/pty.js b/lib/pty.js index 801ba27..3eff68e 100644 --- a/lib/pty.js +++ b/lib/pty.js @@ -292,6 +292,15 @@ Terminal.prototype.setEncoding = function(enc) { } }; +Terminal.prototype.prependListener = function(type, func) { + if (type === 'close') { + this._internalee.prependListener('close', func); + return this; + } + this.socket.prependListener(type, func); + return this; +}; + Terminal.prototype.addListener = Terminal.prototype.on = function(type, func) { if (type === 'close') {