Skip to content

Commit

Permalink
Utilizing the SIGTERM event to complete the exit process during shutd…
Browse files Browse the repository at this point in the history
…own/restart
  • Loading branch information
ircfspace committed Jan 4, 2025
1 parent 87ad715 commit e5b846a
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,21 +377,6 @@ class OblivionDesktop {
});
}

/*private handleShutdown() {
if (this.state.mainWindow) {
this.state.mainWindow.webContents.send('app-shutdown');
}
return new Promise<void>(async (resolve, reject) => {
try {
this.exitProcess();
resolve();
} catch (error) {
reject(error);
log.error('Error during shutdown:', error);
}
});
}*/

private setupAppEvents(): void {
app.on('second-instance', () => {
if (this.state.mainWindow) {
Expand All @@ -415,19 +400,22 @@ class OblivionDesktop {

app.on('before-quit', (event) => {
event.preventDefault();
this.exitProcess();
//this.exitProcess();
});

/*if (process.platform !== 'win32') {
if (process.platform !== 'win32') {
powerMonitor.on('shutdown', async (event: Event) => {
event.preventDefault();
this.handleShutdown();
this.exitProcess();
});
} else {
app.on('session-end', async () => {
this.handleShutdown();
app.on('session-end', () => {
this.exitProcess();
});
}*/
process.on('SIGTERM', () => {
this.exitProcess();
});
}

app.setAsDefaultProtocolClient('oblivion');
app.on('open-url', (event: Event) => {
Expand Down

0 comments on commit e5b846a

Please sign in to comment.