From ce8728961605c5f459d4c4db5bf638e66000ec45 Mon Sep 17 00:00:00 2001 From: Sid Date: Wed, 1 Apr 2026 23:23:43 +0530 Subject: [PATCH] fix: update system proxy fetching to use finally (#7652) * fix: update system proxy fetching to use finally for improved reliability * Update packages/bruno-electron/src/index.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/bruno-electron/src/index.js | 15 +++++++++++---- .../bruno-electron/src/store/shell-env-state.js | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/bruno-electron/src/index.js b/packages/bruno-electron/src/index.js index ab62c48fe..256e252e3 100644 --- a/packages/bruno-electron/src/index.js +++ b/packages/bruno-electron/src/index.js @@ -202,11 +202,18 @@ app.on('ready', async () => { // Initialize system proxy cache early (non-blocking) const { fetchSystemProxy } = require('./store/system-proxy'); - waitForShellEnv().then(() => { - fetchSystemProxy().catch((err) => { - console.warn('Failed to initialize system proxy cache:', err); + + // Note: irrespective of the state of the shell, + // try to fetch the system proxy information + waitForShellEnv() + .catch((err) => { + console.warn('Shell env init failed:', err); + }) + .finally(() => { + fetchSystemProxy().catch((err) => { + console.warn('Failed to initialize system proxy cache:', err); + }); }); - }); Menu.setApplicationMenu(menu); const { maximized, x, y, width, height } = loadWindowState(); diff --git a/packages/bruno-electron/src/store/shell-env-state.js b/packages/bruno-electron/src/store/shell-env-state.js index 95773f8d1..285de0a9e 100644 --- a/packages/bruno-electron/src/store/shell-env-state.js +++ b/packages/bruno-electron/src/store/shell-env-state.js @@ -2,6 +2,7 @@ const { initializeShellEnv: _initializeShellEnv } = require('@usebruno/requests' const TIMEOUT_MS = 60_000; +/** @type {null | Promise} */ let _promise = null; const _initWithTimeout = () => {