diff options
| -rw-r--r-- | gui/scripts/serve.js | 2 | ||||
| -rw-r--r-- | gui/src/shared/ipc-event-channel.ts | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/gui/scripts/serve.js b/gui/scripts/serve.js index 7629628aa2..e1642c5b62 100644 --- a/gui/scripts/serve.js +++ b/gui/scripts/serve.js @@ -17,7 +17,7 @@ const getClientUrl = (options) => { }; function runElectron(browserSyncUrl) { - const child = spawn(electron, ['.', '--enable-logging'], { + const child = spawn(electron, ['.'], { env: { ...{ NODE_ENV: 'development', diff --git a/gui/src/shared/ipc-event-channel.ts b/gui/src/shared/ipc-event-channel.ts index 8cf09078cd..d9f9e4c3c3 100644 --- a/gui/src/shared/ipc-event-channel.ts +++ b/gui/src/shared/ipc-event-channel.ts @@ -1,4 +1,5 @@ import { ipcMain, ipcRenderer, WebContents } from 'electron'; +import log from 'electron-log'; import * as uuid from 'uuid'; import { IGuiSettingsState } from './gui-settings-state'; @@ -333,11 +334,19 @@ function requestHandler<T>(event: string): (fn: (...args: any[]) => Promise<T>) try { const result: RequestResult<T> = { type: 'success', value: await fn(...args) }; - ipcEvent.sender.send(responseEvent, result); + if (ipcEvent.sender.isDestroyed()) { + log.debug(`Cannot send the reply for ${responseEvent} since the sender was destroyed.`); + } else { + ipcEvent.sender.send(responseEvent, result); + } } catch (error) { const result: RequestResult<T> = { type: 'error', message: error.message || '' }; - ipcEvent.sender.send(responseEvent, result); + if (ipcEvent.sender.isDestroyed()) { + log.debug(`Cannot send the reply for ${responseEvent} since the sender was destroyed.`); + } else { + ipcEvent.sender.send(responseEvent, result); + } } }); }; |
