diff --git a/CHANGELOG.md b/CHANGELOG.md index ffbe4078..4e94d48f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Improved error handling when opening browser fails due to System Events permissions or non-standard browser configurations ([#178](https://github.com/MetaMask/create-release-branch/pull/178)) + - Now provides clear manual URL instructions instead of failing with osascript errors + - Handles both cases: when terminal lacks System Events permissions and when using alternative browsers like Brave ## [4.1.1] ### Fixed diff --git a/src/main.ts b/src/main.ts index d8ffb175..88ba8522 100644 --- a/src/main.ts +++ b/src/main.ts @@ -42,7 +42,6 @@ export async function main({ ); if (interactive) { - stdout.write(`Starting UI on port ${port}...\n`); await startUI({ project, releaseType, diff --git a/src/ui.ts b/src/ui.ts index a646f9a7..f4661f63 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -1,7 +1,7 @@ import type { WriteStream } from 'fs'; import { join } from 'path'; import express from 'express'; -import open, { apps } from 'open'; +import open from 'open'; import { restoreChangelogsForSkippedPackages, @@ -86,8 +86,18 @@ export async function startUI({ const server = app.listen(port, async () => { const url = `http://localhost:${port}`; - stdout.write(`UI server running at ${url}\n`); - open(url, { app: { name: apps.browser } }); + + try { + stdout.write(`\nAttempting to open UI in browser...`); + await open(url); + stdout.write(`\nUI server running at ${url}\n`); + } catch (error) { + stderr.write(`\n---------------------------------------------------\n`); + stderr.write(`Error automatically opening browser: ${error}\n`); + stderr.write(`Please open the following URL manually:\n`); + stderr.write(`${url}\n`); + stderr.write(`---------------------------------------------------\n\n`); + } }); return new Promise((resolve, reject) => {