mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-01 19:00:35 +08:00
Add pid check support for Linux
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { exists } from "std/fs/exists.ts";
|
||||
|
||||
export async function check_running(pid: number) {
|
||||
if (Deno.build.os == "windows") {
|
||||
const cmd = new Deno.Command("tasklist.exe", {
|
||||
@@ -9,5 +11,7 @@ export async function check_running(pid: number) {
|
||||
if (o.code !== 0) return;
|
||||
const s = (new TextDecoder()).decode(o.stdout);
|
||||
return s.indexOf(`${pid}`) !== -1;
|
||||
} else if (Deno.build.os == "linux") {
|
||||
return await exists(`/proc/${pid}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user