Skip to content

Commit

Permalink
Update killProcessAndChildren function to killProcesses
Browse files Browse the repository at this point in the history
  • Loading branch information
truemiller committed Feb 27, 2024
1 parent 5521d73 commit 875078e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const {
OperateCmd,
OperateDirectory,
} = require('./install');
const { killProcessAndChildren } = require('./processes');
const { killProcesses } = require('./processes');

// Attempt to acquire the single instance lock
const singleInstanceLock = app.requestSingleInstanceLock();
Expand Down Expand Up @@ -58,15 +58,15 @@ let tray,
async function beforeQuit() {
if (operateDaemonPid) {
try {
await killProcessAndChildren(operateDaemonPid);
await killProcesses(operateDaemonPid);
} catch (e) {
console.error(e);
}
}

if (nextAppProcessPid) {
try {
await killProcessAndChildren(nextAppProcessPid);
await killProcesses(nextAppProcessPid);
} catch (e) {
console.error(e);
}
Expand Down
4 changes: 2 additions & 2 deletions electron/processes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const windowsKillCommand = 'taskkill /F /PID';

const isWindows = process.platform === 'win32';

function killProcessAndChildren(pid) {
function killProcesses(pid) {
return new Promise((resolve, reject) => {
psTree(pid, (err, children) => {
if (err) {
Expand Down Expand Up @@ -37,4 +37,4 @@ function killProcessAndChildren(pid) {
});
}

module.exports = { killProcessAndChildren };
module.exports = { killProcesses };

0 comments on commit 875078e

Please sign in to comment.