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';
/**
* Windows platform adapter
* Implements platform-specific commands for Windows systems
*/
declare class WindowsAdapter extends BaseAdapter {
/**
* Finds processes running on the specified port using netstat
* @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 tasklist
* @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 taskkill command
* @param pid - Process ID to terminate
* @returns True if process was successfully terminated
*/
killProcess(pid: number): Promise<boolean>;
/**
* Kills a process with or without force
* @param pid - Process ID
* @param force - Whether to use force (/F flag)
* @private
*/
private _killWithForce;
/**
* 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 Windows systems
* @returns True if adapter is compatible
*/
isCompatible(): Promise<boolean>;
}
export { WindowsAdapter };
//# sourceMappingURL=windows-adapter.d.ts.map