diff --git a/src/tools/live-utils/start-session.ts b/src/tools/live-utils/start-session.ts index 04960fa5..2fc8500d 100644 --- a/src/tools/live-utils/start-session.ts +++ b/src/tools/live-utils/start-session.ts @@ -94,7 +94,7 @@ function buildDesktopUrl( resolution: "responsive-mode", speed: "1", local: isLocal ? "true" : "false", - start: "true", + ...(isLocal ? {} : { start: "true" }), }); return `https://live.browserstack.com/dashboard#${params.toString()}`; } @@ -120,7 +120,7 @@ function buildMobileUrl( scale_to_fit: "true", speed: "1", local: isLocal ? "true" : "false", - start: "true", + ...(isLocal ? {} : { start: "true" }), }); return `https://live.browserstack.com/dashboard#${params.toString()}`; } @@ -133,13 +133,14 @@ function openBrowser(launchUrl: string): void { process.platform === "darwin" ? ["open", launchUrl] : process.platform === "win32" - ? ["cmd", "/c", "start", launchUrl] + ? ["cmd", "/c", "start", `""`, `"${launchUrl}"`] : ["xdg-open", launchUrl]; // nosemgrep:javascript.lang.security.detect-child-process.detect-child-process const child = childProcess.spawn(command[0], command.slice(1), { stdio: "ignore", detached: true, + ...(process.platform === "win32" ? { shell: true } : {}), }); child.on("error", (err) => logger.error(`Failed to open browser: ${err}. URL: ${launchUrl}`),