mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-14 21:24:58 +08:00
Fix task status reset issue - preserve running tasks on restart
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
co-authored by
whyour
parent
d64dc64df7
commit
f043aa62e4
@@ -397,6 +397,16 @@ export function psTree(pid: number): Promise<number[]> {
|
||||
});
|
||||
}
|
||||
|
||||
export function isPidRunning(pid: number): boolean {
|
||||
try {
|
||||
// Signal 0 doesn't kill the process, just checks if it exists
|
||||
process.kill(pid, 0);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function killTask(pid: number) {
|
||||
const pids = await psTree(pid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user