From 871676005962047378e7af207212c63de6d9986a Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sun, 15 Mar 2026 23:28:00 +1100 Subject: [PATCH] fix(windows): prevent cursor monitor ENOENT crash and build helper in release --- .github/workflows/release.yml | 1 + electron/ipc/handlers.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1827b022..254352d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -119,6 +119,7 @@ jobs: - name: Build Windows x64 shell: pwsh run: | + npm run build:cursor-monitor npx tsc npx vite build npx electron-builder --win nsis --x64 --publish never diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index 4228ab21..3c3430dc 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -1112,6 +1112,13 @@ async function startNativeCursorMonitor() { let helperPath: string if (process.platform === 'win32') { helperPath = getCursorMonitorExePath() + try { + await fs.access(helperPath, fsConstants.X_OK) + } catch { + console.warn('Windows cursor monitor helper missing or not executable:', helperPath) + currentCursorVisualType = 'arrow' + return + } } else { helperPath = await ensureNativeCursorMonitorBinary() } @@ -1122,6 +1129,13 @@ async function startNativeCursorMonitor() { stdio: ['pipe', 'pipe', 'pipe'], }) + nativeCursorMonitorProcess.once('error', (error) => { + console.warn('Native cursor monitor process error:', error) + nativeCursorMonitorProcess = null + nativeCursorMonitorOutputBuffer = '' + currentCursorVisualType = 'arrow' + }) + nativeCursorMonitorProcess.stdout.on('data', handleCursorMonitorStdout) nativeCursorMonitorProcess.once('close', () => {