From d7f141529019b6a26127f73a8f4068663c629390 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Mon, 10 May 2021 16:18:03 -0700 Subject: [PATCH] refactor: use paths.runtime in socket proxyPipe --- src/node/socket.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/node/socket.ts b/src/node/socket.ts index 9c937bbb..39f23dfb 100644 --- a/src/node/socket.ts +++ b/src/node/socket.ts @@ -4,8 +4,7 @@ import * as path from "path" import * as tls from "tls" import { Emitter } from "../common/emitter" import { generateUuid } from "../common/util" -import { tmpdir } from "./constants" -import { canConnect } from "./util" +import { canConnect, paths } from "./util" /** * Provides a way to proxy a TLS socket. Can be used when you need to pass a @@ -13,7 +12,7 @@ import { canConnect } from "./util" */ export class SocketProxyProvider { private readonly onProxyConnect = new Emitter() - private proxyPipe = path.join(tmpdir, "tls-proxy") + private proxyPipe = path.join(paths.runtime, "tls-proxy") private _proxyServer?: Promise private readonly proxyTimeout = 5000 @@ -76,7 +75,10 @@ export class SocketProxyProvider { this._proxyServer = this.findFreeSocketPath(this.proxyPipe) .then((pipe) => { this.proxyPipe = pipe - return Promise.all([fs.mkdir(tmpdir, { recursive: true }), fs.rmdir(this.proxyPipe, { recursive: true })]) + return Promise.all([ + fs.mkdir(paths.runtime, { recursive: true }), + fs.rmdir(this.proxyPipe, { recursive: true }), + ]) }) .then(() => { return new Promise((resolve) => {