From bc9d66417d41d7d3d1ac6546f7ae4eabb41f6f18 Mon Sep 17 00:00:00 2001 From: Dion Date: Mon, 11 Mar 2024 19:11:32 +0100 Subject: [PATCH] remove unused code --- .../app/edit-file/is-application-running.ts | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 starskydesktop/src/app/edit-file/is-application-running.ts diff --git a/starskydesktop/src/app/edit-file/is-application-running.ts b/starskydesktop/src/app/edit-file/is-application-running.ts deleted file mode 100644 index 2d45f5d86d..0000000000 --- a/starskydesktop/src/app/edit-file/is-application-running.ts +++ /dev/null @@ -1,48 +0,0 @@ -import * as childProcess from "child_process"; -import logger from "../logger/logger"; - -export const IsApplicationRunning = (query: string) => { - return new Promise((resolve, reject) => { - const { platform } = process; - let cmd = ""; - let args: string[] = []; - switch (platform) { - case "win32": - cmd = `tasklist`; - break; - case "darwin": - cmd = "sh"; - args = ["-c", `ps aux | grep ${query}`]; - break; - case "linux": - cmd = "ps"; - args = ["-A"]; - break; - default: - break; - } - - const starskyChild = childProcess.spawn(cmd, args); - - let stdOutData = ""; - - starskyChild.stdout.on("data", (stdout: string) => { - stdOutData += stdout.toString(); - }); - - starskyChild.stdout.on("end", () => { - const queryLowercaseNoEscape = `(grep )?${ - query.toLowerCase().replace(/\\ /gi, " ").replace(/\//gi, ".")}`; - const matches = ( - stdOutData.match(new RegExp(queryLowercaseNoEscape, "ig")) || [] - ).filter((p) => p.indexOf("grep") === -1); - resolve(matches.length >= 1); - }); - - starskyChild.stderr.on("data", (data :string) => { - logger.info("IsApplicationRunning"); - logger.info(`stderr: ${data.toString()}`); - reject(); - }); - }); -};