From daf3f2874ee53926d2e461af83057a129bf699d4 Mon Sep 17 00:00:00 2001 From: B Date: Wed, 1 Jun 2022 13:57:24 -0600 Subject: add origin kill --- src/utils.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/utils.js b/src/utils.js index d67792a..061c3f1 100644 --- a/src/utils.js +++ b/src/utils.js @@ -101,6 +101,7 @@ async function isGameRunning() { }); } +//Check if origin client is running async function isOriginRunning() { return new Promise(resolve => { let procs = ["origin.exe"]; //check this, probably not right @@ -123,6 +124,25 @@ async function isOriginRunning() { }); } +//Kill origin client +async function killOrigin() { + return Promise(resolve => { + let proc = "origin.exe" ; //need to match above + let cmd = (() => { + switch (process.platform) { + case "linux": return "killall " + proc; + case "win32": return "taskkill /IM " + proc + " /F"; + } + })(); + + exec(cmd, (err, stdout) => { + //do some checking here maybe? idk we're going to be exiting so maybe we should + //just try and fail silently if we don't find shit + resolve(true); + }); + }); +} + // Handles auto updating Northstar. // // It uses isGameRunning() to ensure it doesn't run while the game is -- cgit v1.2.3