From cce642dfb2c783b480ec95950fc953afc2d5311b Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Fri, 26 Aug 2022 01:10:18 -0700 Subject: [PATCH] Added dispatcher.close() for setclip on Windows, if the dispatcher already exists --- agents/meshcore.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agents/meshcore.js b/agents/meshcore.js index d342653e..db430c45 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -1364,6 +1364,7 @@ function handleServerCommand(data) { var domain = require('user-sessions').getDomain(uid); user = (domain + '\\' + user); + if (this._dispatcher) { this._dispatcher.close(); } this._dispatcher = require('win-dispatcher').dispatch({ user: user, modules: [{ name: 'clip-dispatch', script: "module.exports = { dispatch: function dispatch(val) { require('clipboard')(val); process.exit(); } };" }], launch: { module: 'clip-dispatch', method: 'dispatch', args: [clipargs] } }); this._dispatcher.parent = this; //require('events').setFinalizerMetadata.call(this._dispatcher, 'clip-dispatch'); @@ -4340,6 +4341,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) { var domain = require('user-sessions').getDomain(uid); user = (domain + '\\' + user); + if (this._dispatcher) { this._dispatcher.close(); } this._dispatcher = require('win-dispatcher').dispatch({ user: user, modules: [{ name: 'clip-dispatch', script: "module.exports = { dispatch: function dispatch(val) { require('clipboard')(val); process.exit(); } };" }], launch: { module: 'clip-dispatch', method: 'dispatch', args: [clipargs] } }); this._dispatcher.parent = this; //require('events').setFinalizerMetadata.call(this._dispatcher, 'clip-dispatch');