mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-21 04:00:57 +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 splashWindow;
|
||||
let serverProcess;
|
||||
|
||||
function createSplashWindow() {
|
||||
splashWindow = new BrowserWindow({
|
||||
@@ -44,7 +45,7 @@ function createMainWindow() {
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
const serverProcess = spawn('node', [path.join(__dirname, 'app.js')]); //, {cwd: 'backend'});
|
||||
serverProcess = spawn('node', [path.join(__dirname, 'app.js')]);
|
||||
|
||||
createMainWindow();
|
||||
createSplashWindow();
|
||||
@@ -77,6 +78,10 @@ app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
if (serverProcess) {
|
||||
serverProcess.stdin.pause();
|
||||
serverProcess.kill();
|
||||
}
|
||||
});
|
||||
|
||||
// initialize the app's main window
|
||||
|
||||
Reference in New Issue
Block a user