Skip to content

Commit 231c516

Browse files
authored
fix(dev): use os tmp dir for unix sockets (#3179)
1 parent 036f341 commit 231c516

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/core/dev-server/worker.ts

-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ export class NodeDevWorker implements DevWorker {
9191
env: {
9292
...process.env,
9393
NITRO_DEV_WORKER_ID: String(this.#id),
94-
NITRO_DEV_WORKER_DIR: this.#workerDir,
9594
},
9695
}) as Worker & { _exitCode?: number };
9796

src/presets/_nitro/runtime/nitro-dev.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import "#nitro-internal-pollyfills";
2+
import { tmpdir } from "node:os";
23
import { useNitroApp } from "nitropack/runtime";
34
import { runTask } from "nitropack/runtime";
45
import { trapUnhandledNodeErrors } from "nitropack/runtime/internal";
@@ -9,7 +10,6 @@ import { join } from "node:path";
910
import nodeCrypto from "node:crypto";
1011
import { parentPort, threadId } from "node:worker_threads";
1112
import wsAdapter from "crossws/adapters/node";
12-
import { isCI } from "std-env";
1313
import {
1414
defineEventHandler,
1515
getQuery,
@@ -23,11 +23,7 @@ if (!globalThis.crypto) {
2323
globalThis.crypto = nodeCrypto as unknown as Crypto;
2424
}
2525

26-
const {
27-
NITRO_NO_UNIX_SOCKET,
28-
NITRO_DEV_WORKER_DIR = ".",
29-
NITRO_DEV_WORKER_ID,
30-
} = process.env;
26+
const { NITRO_NO_UNIX_SOCKET, NITRO_DEV_WORKER_ID } = process.env;
3127

3228
// Trap unhandled errors
3329
trapUnhandledNodeErrors();
@@ -133,7 +129,7 @@ function getSocketAddress() {
133129
}
134130
}
135131
// Unix socket
136-
return join(NITRO_DEV_WORKER_DIR, socketName);
132+
return join(tmpdir(), socketName);
137133
}
138134

139135
async function shutdown() {

0 commit comments

Comments
 (0)