Skip to content

Commit 4793dbf

Browse files
committed
refactor: use paths.runtime in socket proxyPipe
1 parent a128b79 commit 4793dbf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/node/socket.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ import * as path from "path"
44
import * as tls from "tls"
55
import { Emitter } from "../common/emitter"
66
import { generateUuid } from "../common/util"
7-
import { tmpdir } from "./constants"
8-
import { canConnect } from "./util"
7+
import { canConnect, paths } from "./util"
98

109
/**
1110
* Provides a way to proxy a TLS socket. Can be used when you need to pass a
1211
* socket to a child process since you can't pass the TLS socket.
1312
*/
1413
export class SocketProxyProvider {
1514
private readonly onProxyConnect = new Emitter<net.Socket>()
16-
private proxyPipe = path.join(tmpdir, "tls-proxy")
15+
private proxyPipe = path.join(paths.runtime, "tls-proxy")
1716
private _proxyServer?: Promise<net.Server>
1817
private readonly proxyTimeout = 5000
1918

@@ -76,7 +75,10 @@ export class SocketProxyProvider {
7675
this._proxyServer = this.findFreeSocketPath(this.proxyPipe)
7776
.then((pipe) => {
7877
this.proxyPipe = pipe
79-
return Promise.all([fs.mkdir(tmpdir, { recursive: true }), fs.rmdir(this.proxyPipe, { recursive: true })])
78+
return Promise.all([
79+
fs.mkdir(paths.runtime, { recursive: true }),
80+
fs.rmdir(this.proxyPipe, { recursive: true }),
81+
])
8082
})
8183
.then(() => {
8284
return new Promise((resolve) => {

0 commit comments

Comments
 (0)