Skip to content

Commit

Permalink
Use unique socket path per user.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleexyz committed Jun 20, 2023
1 parent 26c1bdd commit f8c030d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/node/vscodeSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { listen } from "./app"
import { canConnect } from "./util"

// Socket path of the daemonized code-server instance.
export const DEFAULT_SOCKET_PATH = path.join(os.tmpdir(), "code-server-ipc.sock")
export const DEFAULT_SOCKET_PATH = path.join(os.tmpdir(), `code-server-ipc-${os.userInfo().username}.sock`)

export interface EditorSessionEntry {
workspace: {
Expand Down
12 changes: 11 additions & 1 deletion test/unit/node/vscodeSocket.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import { logger } from "@coder/logger"
import * as os from "os"
import * as app from "../../../src/node/app"
import { EditorSessionManager, makeEditorSessionManagerServer } from "../../../src/node/vscodeSocket"
import {
DEFAULT_SOCKET_PATH,
EditorSessionManager,
makeEditorSessionManagerServer,
} from "../../../src/node/vscodeSocket"
import { clean, tmpdir, listenOn, mockLogger } from "../../utils/helpers"

describe("DEFAULT_SOCKET_PATH", () => {
it("should be a unique path per user", () => {
expect(DEFAULT_SOCKET_PATH).toBe(`${os.tmpdir()}/code-server-ipc-${os.userInfo().username}.sock`)
})
})
describe("makeEditorSessionManagerServer", () => {
let tmpDirPath: string

Expand Down

0 comments on commit f8c030d

Please sign in to comment.