mirror of
https://github.com/RPCSX/rpcsx-ui.git
synced 2026-01-31 01:05:23 +01:00
desktop: gracefully shutdown on sigint/sigterm/sigquit
This commit is contained in:
@@ -86,20 +86,35 @@ export async function initialize() {
|
||||
}
|
||||
});
|
||||
|
||||
app.on('window-all-closed', async () => {
|
||||
|
||||
let shutdownRequested = false;
|
||||
const shutdown = async () => {
|
||||
if (shutdownRequested) {
|
||||
return;
|
||||
}
|
||||
shutdownRequested = true;
|
||||
|
||||
app.quit();
|
||||
|
||||
try {
|
||||
await core.shutdown(undefined);
|
||||
} catch (e) {
|
||||
console.error("shutdown throws exception", e);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
await app.whenReady();
|
||||
|
||||
process.on('SIGINT', () => shutdown());
|
||||
process.on('SIGTERM', () => shutdown());
|
||||
process.on('SIGQUIT', () => shutdown());
|
||||
|
||||
const uiPath = path.join(import.meta.dirname, "ui");
|
||||
|
||||
const fixPath = async (loc: PathLike) => {
|
||||
|
||||
@@ -82,7 +82,8 @@ class JsonRpcProtocol implements ExternalComponentInterface {
|
||||
clearTimeout(this.responseWatchdog);
|
||||
}
|
||||
|
||||
// uninitializeComponent(this.componentManifest);
|
||||
|
||||
self.destroyObject(objectId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user