mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-23 01:33:19 +03:00
Ensure process is killed on electron close
This commit is contained in:
@@ -4,6 +4,7 @@ const { spawn } = require('child_process');
|
|||||||
|
|
||||||
let win;
|
let win;
|
||||||
let splashWindow;
|
let splashWindow;
|
||||||
|
let serverProcess;
|
||||||
|
|
||||||
function createSplashWindow() {
|
function createSplashWindow() {
|
||||||
splashWindow = new BrowserWindow({
|
splashWindow = new BrowserWindow({
|
||||||
@@ -44,7 +45,7 @@ function createMainWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
const serverProcess = spawn('node', [path.join(__dirname, 'app.js')]); //, {cwd: 'backend'});
|
serverProcess = spawn('node', [path.join(__dirname, 'app.js')]);
|
||||||
|
|
||||||
createMainWindow();
|
createMainWindow();
|
||||||
createSplashWindow();
|
createSplashWindow();
|
||||||
@@ -77,6 +78,10 @@ app.on('window-all-closed', () => {
|
|||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
if (serverProcess) {
|
||||||
|
serverProcess.stdin.pause();
|
||||||
|
serverProcess.kill();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// initialize the app's main window
|
// initialize the app's main window
|
||||||
|
|||||||
Reference in New Issue
Block a user