From 822814206072106fd69789e08c93829be47c6cc7 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 9 Jun 2015 05:13:11 -0700 Subject: [PATCH] allow any kind of stream as input and output. fixes #138. --- lib/program.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/program.js b/lib/program.js index 7a0abcb..1b7aa72 100644 --- a/lib/program.js +++ b/lib/program.js @@ -318,7 +318,7 @@ Program.prototype.listen = function() { this.on('newListener', function fn(type) { if (type === 'keypress' || type === 'mouse') { self.removeListener('newListener', fn); - if (!self.input.isRaw) { + if (self.input.setRawMode && !self.input.isRaw) { self.input.setRawMode(true); self.input.resume(); } @@ -3971,13 +3971,17 @@ Program.prototype.pause = function(callback) { var write = this.output.write; this.output.write = function() {}; - this.input.setRawMode(false); + if (this.input.setRawMode) { + this.input.setRawMode(false); + } this.input.pause(); return this._resume = function() { delete self._resume; - self.input.setRawMode(true); + if (self.input.setRawMode) { + self.input.setRawMode(true); + } self.input.resume(); self.output.write = write;