依赖管理支持取消安装和状态筛选

This commit is contained in:
whyour
2024-02-13 22:42:22 +08:00
parent 892d91edc4
commit 14cb1f7788
9 changed files with 209 additions and 51 deletions
+2 -2
View File
@@ -435,8 +435,8 @@ export async function killTask(pid: number) {
}
}
export async function getPid(name: string) {
const taskCommand = `ps -eo pid,command | grep "${name}" | grep -v grep | awk '{print $1}' | head -1 | xargs echo -n`;
export async function getPid(cmd: string) {
const taskCommand = `ps -eo pid,command | grep "${cmd}" | grep -v grep | awk '{print $1}' | head -1 | xargs echo -n`;
const pid = await promiseExec(taskCommand);
return pid ? Number(pid) : undefined;
}