8000 fix(socket): use xdgBasedir.runtime instead of tmp by jsjoeio · Pull Request #3304 · coder/code-server · GitHub
[go: up one dir, main page]

Skip to content

fix(socket): use xdgBasedir.runtime instead of tmp #3304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 13, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: use paths.runtime in socket proxyPipe
  • Loading branch information
jsjoeio committed May 13, 2021
commit d7f141529019b6a26127f73a8f4068663c629390
10 changes: 6 additions & 4 deletions src/node/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ 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
* socket to a child process since you can't pass the TLS socket.
*/
export class SocketProxyProvider {
private readonly onProxyConnect = new Emitter<net.Socket>()
private proxyPipe = path.join(tmpdir, "tls-proxy")
private proxyPipe = path.join(paths.runtime, "tls-proxy")
private _proxyServer?: Promise<net.Server>
private readonly proxyTimeout = 5000

Expand Down Expand Up @@ -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) => {
Expand Down
0