browser-debugger-cli
Version:
DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port.
55 lines • 1.45 kB
TypeScript
/**
* Session PID file management.
*
* Handles reading/writing the main session PID file for tracking active sessions.
* WHY: Centralized PID operations prevent inconsistencies in session tracking.
*/
/**
* Read and parse a PID from a file.
*
* @param filePath - Path to the PID file
* @returns Parsed PID or null if file doesn't exist or contains invalid data
*
* @example
* ```typescript
* const daemonPid = readPidFromFile('/path/to/daemon.pid');
* if (daemonPid && isProcessAlive(daemonPid)) {
* console.log('Daemon is running');
* }
* ```
*/
export declare function readPidFromFile(filePath: string): number | null;
/**
* Write the current process PID to the session file atomically.
*
* Uses atomic write (tmp file + rename) to prevent corruption if process crashes.
*
* @param pid - Process ID to write
*
* @example
* ```typescript
* writePid(process.pid);
* ```
*/
export declare function writePid(pid: number): void;
/**
* Read the PID from the session file.
*
* @returns The PID if file exists and is valid, null otherwise
*
* @example
* ```typescript
* const sessionPid = readPid();
* if (sessionPid && isProcessAlive(sessionPid)) {
* console.log('Session is running');
* }
* ```
*/
export declare function readPid(): number | null;
/**
* Remove the PID file.
*
* Safe to call multiple times (idempotent).
*/
export declare function cleanupPidFile(): void;
//# sourceMappingURL=pid.d.ts.map