Backup restore() when 'close' fails to fire

This commit is contained in:
Bryan Ashby 2015-12-28 16:34:28 -07:00
parent 0658d5af52
commit db014c16bf
1 changed files with 9 additions and 1 deletions

View File

@ -47,10 +47,13 @@ Door.prototype.run = function() {
self.client.term.write(decode(data, self.exeInfo.encoding));
};
var restored = false;
var restore = function(piped) {
if(self.client.term.output) {
if(!restored && self.client.term.output) {
self.client.term.output.unpipe(piped);
self.client.term.output.resume();
restored = true;
}
};
@ -133,6 +136,11 @@ Door.prototype.run = function() {
sockServer.close();
}
// we may not get a close
if('stdio' === self.exeInfo.io) {
restore(door);
}
door.removeAllListeners();
self.emit('finished');