allow any kind of stream as input and output. fixes #138.
This commit is contained in:
parent
983b5a745a
commit
8228142060
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue