mirror of
https://github.com/frappe/books.git
synced 2024-11-13 00:46:28 +00:00
28 lines
664 B
TypeScript
28 lines
664 B
TypeScript
import { app } from 'electron';
|
|
import { Main } from '../main';
|
|
import { handleError } from '../src/errorHandling';
|
|
|
|
export default function registerProcessListeners(main: Main) {
|
|
if (main.isDevelopment) {
|
|
if (process.platform === 'win32') {
|
|
process.on('message', (data) => {
|
|
if (data === 'graceful-exit') {
|
|
app.quit();
|
|
}
|
|
});
|
|
} else {
|
|
process.on('SIGTERM', () => {
|
|
app.quit();
|
|
});
|
|
}
|
|
}
|
|
|
|
process.on('unhandledRejection', (error: Error) => {
|
|
handleError(true, error);
|
|
});
|
|
|
|
process.on('uncaughtException', (error) => {
|
|
handleError(true, error, {}, () => process.exit(1));
|
|
});
|
|
}
|