mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 14:19:56 +00:00
fix(health): use prefix matching for Linux process name truncation
Linux kernel truncates process names to 15 chars, causing 'cli-proxy-api-plus' to appear as 'cli-proxy-api-p' in lsof output. Switch from exact whitelist to prefix matching for robust detection.
This commit is contained in:
+4
-13
@@ -111,26 +111,17 @@ async function getPortProcessWindows(port: number): Promise<PortProcess | null>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if process is CLIProxy
|
* Check if process is CLIProxy
|
||||||
|
* Uses prefix matching to handle Linux kernel's 15-char process name truncation
|
||||||
|
* (e.g., 'cli-proxy-api-plus' becomes 'cli-proxy-api-p' in lsof/ps output)
|
||||||
*/
|
*/
|
||||||
export function isCLIProxyProcess(process: PortProcess | null): boolean {
|
export function isCLIProxyProcess(process: PortProcess | null): boolean {
|
||||||
if (!process) {
|
if (!process) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match various CLIProxy binary names
|
|
||||||
const name = process.processName.toLowerCase();
|
const name = process.processName.toLowerCase();
|
||||||
return [
|
// All CLIProxy variants start with 'cli-proxy' or 'cliproxy'
|
||||||
'cli-proxy',
|
return name.startsWith('cli-proxy') || name.startsWith('cliproxy');
|
||||||
'cli-proxy.exe',
|
|
||||||
'cliproxy',
|
|
||||||
'cliproxy.exe',
|
|
||||||
'cli-proxy-api',
|
|
||||||
'cli-proxy-api.exe',
|
|
||||||
'cliproxyapi',
|
|
||||||
'cliproxyapi.exe',
|
|
||||||
'cli-proxy-api-plus',
|
|
||||||
'cli-proxy-api-plus.exe',
|
|
||||||
].includes(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user