mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 09:45:36 +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:
1 parent
d64dc64df7
commit
f043aa62e4
2 files changed
+25
-2
No files matched your search
@@ -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