portfree
Version:
A cross-platform CLI tool for managing processes running on specific ports
59 lines • 1.81 kB
TypeScript
import { BaseAdapter } from './base-adapter';
import { Process as FreePortProcess } from '../models/process';
/**
* Unix (Linux/macOS) platform adapter
* Implements platform-specific commands for Unix-like systems
*/
declare class UnixAdapter extends BaseAdapter {
/**
* Finds processes running on the specified port using lsof
* @param port - Port number to check
* @returns Array of process objects
*/
findProcessByPort(port: number): Promise<FreePortProcess[]>;
/**
* Gets detailed information about a process by PID using ps
* @param pid - Process ID
* @returns Process details object
*/
getProcessDetails(pid: number): Promise<{
pid: number;
user: string;
name: string;
command: string;
}>;
/**
* Terminates a process by PID using kill command
* @param pid - Process ID to terminate
* @returns True if process was successfully terminated
*/
killProcess(pid: number): Promise<boolean>;
/**
* Kills a process with a specific signal
* @param pid - Process ID
* @param signal - Signal name (TERM, KILL, etc.)
* @private
*/
private _killWithSignal;
/**
* Checks if a process is still running
* @param pid - Process ID
* @returns True if process is running
* @private
*/
private _isProcessRunning;
/**
* Sleep for specified milliseconds
* @param ms - Milliseconds to sleep
* @returns Promise that resolves after the specified time
* @private
*/
private _sleep;
/**
* Validates if the adapter can run on Unix systems
* @returns True if adapter is compatible
*/
isCompatible(): Promise<boolean>;
}
export { UnixAdapter };
//# sourceMappingURL=unix-adapter.d.ts.map