mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-14 13:00:49 +08:00
Optimize PID validation and use bulk database update
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
co-authored by
whyour
parent
f043aa62e4
commit
1124040eeb
@@ -398,6 +398,11 @@ export function psTree(pid: number): Promise<number[]> {
|
||||
}
|
||||
|
||||
export function isPidRunning(pid: number): boolean {
|
||||
// Validate PID is a positive integer
|
||||
if (!pid || pid <= 0 || !Number.isInteger(pid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// Signal 0 doesn't kill the process, just checks if it exists
|
||||
process.kill(pid, 0);
|
||||
|
||||
Reference in New Issue
Block a user