Browse Source
To be improved: this commits introduce regression on OSX behaviour when hiding the window: before it was keeping the app opened, and auto locking it. Now it kills it :D I honestly think it's worth it regarding the problem zombies process causes (LOCK on sqlite...).master
meriadec
7 years ago
3 changed files with 57 additions and 14 deletions
@ -0,0 +1,32 @@ |
|||
// @flow
|
|||
|
|||
// <((((((\\\
|
|||
// / . }\
|
|||
// ;--..--._|}
|
|||
// (\ '--/\--' )
|
|||
// DISCLAIMER \\ | '-' :'|
|
|||
// This is a dirty hack \\ . -==- .-|
|
|||
// \\ \.__.' \--._
|
|||
// [\\ __.--| // _/'--.
|
|||
// \ \\ .'-._ ('-----'/ __/ \
|
|||
// \ \\ / __>| | '--. |
|
|||
// \ \\ | \ | / / /
|
|||
// \ '\ / \ | | _/ /
|
|||
// \ \ \ | | / /
|
|||
// \ \ \ /
|
|||
|
|||
let MAIN_PROCESS_PID: ?number = null |
|||
let INTERNAL_PROCESS_PID: ?number = null |
|||
|
|||
function kill(processType, pid) { |
|||
console.log(`-> Killing ${processType} process ${pid}`) // eslint-disable-line no-console
|
|||
process.kill(pid, 'SIGTERM') |
|||
} |
|||
|
|||
exports.setMainProcessPID = (pid: number) => (MAIN_PROCESS_PID = pid) |
|||
exports.setInternalProcessPID = (pid: number) => (INTERNAL_PROCESS_PID = pid) |
|||
|
|||
exports.terminateAllTheThings = () => { |
|||
if (INTERNAL_PROCESS_PID) kill('internal', INTERNAL_PROCESS_PID) |
|||
if (MAIN_PROCESS_PID) kill('main', MAIN_PROCESS_PID) |
|||
} |
Loading…
Reference in new issue