Skip to content

Commit

Permalink
use default tmp directory for constructing socket path
Browse files Browse the repository at this point in the history
  • Loading branch information
Mastercuber committed Aug 20, 2023
1 parent 527c580 commit 93483dc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/_utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { networkInterfaces, platform } from "node:os";
import { relative } from "pathe";
import { networkInterfaces, platform, tmpdir } from "node:os";
import { relative, join } from "pathe";
import { colors } from "consola/utils";
import { ListenURL, ListenOptions } from "./types";

Expand Down Expand Up @@ -40,9 +40,13 @@ export function formatURL(url: string) {
}

export function getSocketPath(ipcSocketName: string) {
return platform() === "win32"
? `\\\\?\\pipe\\${ipcSocketName || "listhen"}`
: `/tmp/${ipcSocketName || "listhen"}.socket`;
if (platform() === "win32") {
return `\\\\?\\pipe\\${ipcSocketName || "listhen"}`;
}

Check warning on line 45 in src/_utils.ts

View check run for this annotation

Codecov / codecov/patch

src/_utils.ts#L44-L45

Added lines #L44 - L45 were not covered by tests
return join(
tmpdir(),
ipcSocketName ? `${ipcSocketName}.socket` : "listhen.socket",
);
}

export const IPC_NOT_USED_NAME = "_____";
Expand Down

0 comments on commit 93483dc

Please sign in to comment.