From b9fae99ddc950bf287ebf396533cd6684fd7c3ec Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 2 Jul 2018 20:30:18 -0600 Subject: [PATCH] winfix: better pipe support --- bin/telebitd.js | 8 +++++--- lib/cli-common.js | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/telebitd.js b/bin/telebitd.js index 3fa160f..a5933c0 100755 --- a/bin/telebitd.js +++ b/bin/telebitd.js @@ -571,11 +571,13 @@ function serveControlsHelper() { // mask is so that processes owned by other users // can speak to this process, which is probably root-owned var oldUmask = process.umask(0x0000); - require('mkdirp').sync(path.resolve(state._ipc.path, '..')); + if ('socket' === state._ipc.type) { + require('mkdirp').sync(path.dirname(state._ipc.path)); + } controlServer.listen({ - path: state._ipc.path + path: state._ipc.path || null , host: 'localhost' - //, port: 0 + , port: state._ipc.port || null , writableAll: true , readableAll: true , exclusive: false diff --git a/lib/cli-common.js b/lib/cli-common.js index 728dc36..72424ee 100644 --- a/lib/cli-common.js +++ b/lib/cli-common.js @@ -81,7 +81,9 @@ common.pipename = function (config) { , type: (/^win/i.test(os.platform()) ? 'pipe' : 'socket') }; if ('pipe' === _ipc.type) { - _ipc.path = '\\\\?\\pipe' + _ipc.path.replace(/\//, '\\'); + // https://docs.microsoft.com/en-us/windows/desktop/ipc/pipe-names + // Allows all characters accept backslash as part of the name + _ipc.path = '\\\\.\\pipe\\' + _ipc.path.replace(/\\/g, '/'); } return _ipc; };