UNPKG

browser-debugger-cli

Version:

DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port.

57 lines 1.77 kB
/** * Session lock management for preventing concurrent sessions. * * Uses exclusive file creation (wx flag) with PID tracking for atomic lock acquisition. * WHY: Prevents race conditions when multiple bdg processes try to start simultaneously. */ /** * Acquire session lock atomically. * * Uses exclusive file creation (wx flag) to ensure only one session can run. * If lock file exists but process is dead, automatically removes stale lock and retries. * * @returns True if lock was acquired, false if another session is running * * @example * ```typescript * if (!acquireSessionLock()) { * console.error('Another session is already running'); * process.exit(1); * } * ``` */ export declare function acquireSessionLock(): boolean; /** * Release session lock. * * Removes the lock file to allow other sessions to start. * Safe to call multiple times (idempotent). */ export declare function releaseSessionLock(): void; /** * Acquire daemon lock atomically. * * Uses exclusive file creation (wx flag) to ensure only one daemon can start. * If lock file exists but process is dead, automatically removes stale lock and retries. * * WHY: Prevents race condition where two concurrent bdg commands spawn 2 daemons. * * @returns True if lock was acquired, false if another daemon startup is in progress * * @example * ```typescript * if (!acquireDaemonLock()) { * console.error('Another daemon is starting up'); * process.exit(1); * } * ``` */ export declare function acquireDaemonLock(): boolean; /** * Release daemon lock. * * Removes the daemon lock file to allow other daemon startups. * Safe to call multiple times (idempotent). */ export declare function releaseDaemonLock(): void; //# sourceMappingURL=lock.d.ts.map