function socket
socket(
cwd?: string,
platform?: NodeJS.Platform
): string

Returns the per-cwd path the daemon listens on. Platform-specific:

  • POSIX: a Unix domain socket file under os.tmpdir() (/tmp/qunitx-daemon-<hash>.sock).
  • Windows: a named pipe under the special \\.\pipe\ namespace (\\.\pipe\qunitx-daemon-<hash>). Node maps net.Server.listen(pipePath) to a Win32 named pipe; a regular tmpdir filesystem path silently fails to bind.

platform is parameterized for testability; it defaults to process.platform.

import * as Paths from './paths.ts';

Paths.socket('/home/me/app', 'linux'); // '/tmp/qunitx-daemon-<12-hex>.sock'
Paths.socket('/home/me/app', 'win32'); // '\\.\pipe\qunitx-daemon-<12-hex>'

Parameters

optional
cwd: string
optional
platform: NodeJS.Platform = [process.platform]

Return Type

string

Usage

import { socket } from "lib/commands/daemon/paths.ts";