From 73a4ddff081412518e3ff6eb27316e7fb579ebeb Mon Sep 17 00:00:00 2001 From: Oj Date: Mon, 9 Jan 2023 11:03:59 +0000 Subject: [PATCH] idle: add linux/mac hibernation support --- src/api/idle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/idle.js b/src/api/idle.js index c794e87..9c972e1 100644 --- a/src/api/idle.js +++ b/src/api/idle.js @@ -1,6 +1,6 @@ import { exec } from 'child_process'; -const killProcesses = async pids => process.platform !== 'win32' ? Promise.resolve('') : new Promise(resolve => exec(`taskkill /F ${pids.map(x => `/PID ${x}`).join(' ')}`, (e, out) => resolve(out))); +const killProcesses = async pids => new Promise(resolve => exec(process.platform !== 'win32' ? `kill -9 ${pids.join(' ')}` : `taskkill /F ${pids.map(x => `/PID ${x}`).join(' ')}`, (e, out) => resolve(out))); export default async (CDP, { browserEngine, closeHandlers }) => { if (browserEngine !== 'chromium') { // current implementation is for chromium-based only @@ -44,7 +44,7 @@ export default async (CDP, { browserEngine, closeHandlers }) => { let wakeUrl, hibernating = false; const hibernate = async () => { // hibernate - crashing chromium internally to save max memory. users will see a crash/gone wrong page but we hopefully "reload" quick enough once visible again for not much notice. if (hibernating) return; - if (process.platform !== 'win32') return sleep(); // sleep instead - full hibernation is windows only for now due to needing to do native things + // if (process.platform !== 'win32') return sleep(); // sleep instead - full hibernation is windows only for now due to needing to do native things hibernating = true;