diff options
author | B <fitnessnonsense@gmail.com> | 2022-06-01 13:57:24 -0600 |
---|---|---|
committer | B <fitnessnonsense@gmail.com> | 2022-06-01 13:57:24 -0600 |
commit | daf3f2874ee53926d2e461af83057a129bf699d4 (patch) | |
tree | 5119ab15babe420ba8faafa725fd3d1e0520426a | |
parent | e0f0ff86338e48a97fed152eca20d9497730e9d4 (diff) | |
download | Viper-daf3f2874ee53926d2e461af83057a129bf699d4.tar.gz Viper-daf3f2874ee53926d2e461af83057a129bf699d4.zip |
add origin kill
-rw-r--r-- | src/utils.js | 20 |
1 files changed, 20 insertions, 0 deletions
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 |