From 6e6ebc9b1890559faca7fdc1637e103722e73639 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Mon, 20 Jun 2016 00:40:31 -0600 Subject: [PATCH] * Fix menu stack corruption reported by apam when 'exit' (and possibly other) pty events fire 2+ times --- core/door.js | 8 ++++---- mods/abracadabra.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/door.js b/core/door.js index c50503cd..2cca1151 100644 --- a/core/door.js +++ b/core/door.js @@ -73,11 +73,11 @@ Door.prototype.run = function() { conn.on('data', doorData); - conn.on('end', function ended() { + conn.once('end', function ended() { restore(conn); }); - conn.on('error', function error(err) { + conn.once('error', function error(err) { self.client.log.info('Door socket server connection error: ' + err.message); restore(conn); }); @@ -120,7 +120,7 @@ Door.prototype.run = function() { door.on('data', doorData); - door.on('close', function closed() { + door.once('close', function closed() { restore(door); }); } else if('socket' === self.exeInfo.io) { @@ -129,7 +129,7 @@ Door.prototype.run = function() { 'Using temporary socket server for door I/O'); } - door.on('exit', function exited(code) { + door.once('exit', function exited(code) { self.client.log.info( { code : code }, 'Door exited'); if(sockServer) { diff --git a/mods/abracadabra.js b/mods/abracadabra.js index c617763c..665a5ffe 100644 --- a/mods/abracadabra.js +++ b/mods/abracadabra.js @@ -165,7 +165,7 @@ function AbracadabraModule(options) { const doorInstance = new door.Door(self.client, exeInfo); - doorInstance.on('finished', () => { + doorInstance.once('finished', () => { self.prevMenu(); });