From 45ea5722b834767b2a42cd4674894b3f03171b5a Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Thu, 23 May 2019 16:27:37 -0700 Subject: [PATCH] updated to cleanup better --- modules/message-box.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/message-box.js b/modules/message-box.js index e2f5e5b..893af1a 100644 --- a/modules/message-box.js +++ b/modules/message-box.js @@ -270,7 +270,7 @@ function macos_messageBox() ret.ipcpath = '/var/tmp/' + process.execPath.split('/').pop() + '_ev'; var n = 0; - while (require('fs').existsSync(ret.ipcPath + n)) { ++n; } + while (require('fs').existsSync(ret.ipcpath + n)) { ++n; } ret.ipcpath += n; ret.title = title; @@ -364,6 +364,7 @@ function macos_messageBox() if (require('fs').existsSync(options.path)) { require('fs').unlinkSync(options.path); } this._messageServer = require('net').createServer(); + this._messageServer._options = options; this._messageServer.timer = setTimeout(function (obj) { obj.close(); @@ -430,6 +431,17 @@ function macos_messageBox() } }); }); + + this._messageServer.on('~', function () + { + try { + require('fs').unlinkSync(this._options.path); + } + catch (e) + { + } + }); + return (this._messageServer); }; }