diff --git a/electron/src/index.ts b/electron/src/index.ts index e23f2bb3..3a44468e 100644 --- a/electron/src/index.ts +++ b/electron/src/index.ts @@ -9,7 +9,32 @@ import { autoUpdater } from 'electron-updater'; import { ElectronCapacitorApp, setupContentSecurityPolicy, setupReloadWatcher } from './setup'; // Graceful handling of unhandled errors. -unhandled(); +unhandled({ + logger: (error) => { + // Suppress EPIPE errors which are common in AppImages due to console output issues + if (error.message && error.message.includes('EPIPE')) { + return; // Don't log EPIPE errors + } + console.error('Unhandled error:', error); + } +}); + +// Handle EPIPE errors on stdout/stderr to prevent crashes +process.stdout.on('error', (err) => { + if (err.code === 'EPIPE') { + // Ignore EPIPE errors on stdout + return; + } + console.error('stdout error:', err); +}); + +process.stderr.on('error', (err) => { + if (err.code === 'EPIPE') { + // Ignore EPIPE errors on stderr + return; + } + console.error('stderr error:', err); +}); // Define our menu templates (these are optional) const trayMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [new MenuItem({ label: 'Quit App', role: 'quit' })];