Browse Source
Merge pull request #772 from meriadec/trying-to-fix-process-problems
Let main process kill itself, kill only internal process on win close
master
Gaëtan Renaudeau
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
1 additions and
6 deletions
-
src/main/app.js
-
src/main/terminator.js
|
|
@ -12,9 +12,7 @@ import { |
|
|
|
import menu from 'main/menu' |
|
|
|
import db from 'helpers/db' |
|
|
|
|
|
|
|
import { setMainProcessPID, terminateAllTheThings } from './terminator' |
|
|
|
|
|
|
|
setMainProcessPID(process.pid) |
|
|
|
import { terminateAllTheThings } from './terminator' |
|
|
|
|
|
|
|
// necessary to prevent win from being garbage collected
|
|
|
|
let mainWindow = null |
|
|
|
|
|
@ -15,7 +15,6 @@ |
|
|
|
// \ \ \ | | / /
|
|
|
|
// \ \ \ /
|
|
|
|
|
|
|
|
let MAIN_PROCESS_PID: ?number = null |
|
|
|
let INTERNAL_PROCESS_PID: ?number = null |
|
|
|
|
|
|
|
function kill(processType, pid) { |
|
|
@ -23,10 +22,8 @@ function kill(processType, pid) { |
|
|
|
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) |
|
|
|
} |
|
|
|