or run

npx @tessl/cli init
Log in

Version

Files

docs

index.mdport-configuration.mdport-finding.mdsocket-finding.md
tile.json

task.mdevals/scenario-4/

IPC Socket Path Allocator

Produce a free local IPC endpoint path suitable for Unix domain sockets or Windows named pipes. When no options are provided, default to a socket file named ipc.sock in the system temporary directory.

Capabilities

Returns default when free

  • With no options, returns the default base path under the system temp directory and ensures it points to a non-existent socket file. @test

Skips existing socket file

  • When the requested base path already exists, returns the next available candidate by appending incremental numeric suffixes before the file extension (e.g., /tmp/app.sock, /tmp/app-1.sock, /tmp/app-2.sock). @test

Handles Windows pipe names

  • When given a Windows pipe name (\\\\.\\pipe\\service), returns a free named pipe path and increments suffixes on collisions instead of switching to Unix-style paths. @test

Creates missing directories

  • When the provided base path resides in a directory that does not yet exist, creates the parent directories before returning the free socket path. @test

Implementation

@generates

API

export interface SocketOptions {
  basePath?: string;
}

export async function findAvailableSocket(options?: SocketOptions): Promise<string>;

Dependencies { .dependencies }

portfinder { .dependency }

Finds available IPC endpoints for Unix sockets and Windows named pipes.