Skip to content

Commit 06c2bef

Browse files
Merge pull request #172 from browserstack/beta
fix: live tools not redirecting properly in windows machines
2 parents 1385177 + b6cc8b4 commit 06c2bef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/tools/live-utils/start-session.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function buildDesktopUrl(
9494
resolution: "responsive-mode",
9595
speed: "1",
9696
local: isLocal ? "true" : "false",
97-
start: "true",
97+
...(isLocal ? {} : { start: "true" }),
9898
});
9999
return `https://live.browserstack.com/dashboard#${params.toString()}`;
100100
}
@@ -120,7 +120,7 @@ function buildMobileUrl(
120120
scale_to_fit: "true",
121121
speed: "1",
122122
local: isLocal ? "true" : "false",
123-
start: "true",
123+
...(isLocal ? {} : { start: "true" }),
124124
});
125125
return `https://live.browserstack.com/dashboard#${params.toString()}`;
126126
}
@@ -133,13 +133,14 @@ function openBrowser(launchUrl: string): void {
133133
process.platform === "darwin"
134134
? ["open", launchUrl]
135135
: process.platform === "win32"
136-
? ["cmd", "/c", "start", launchUrl]
136+
? ["cmd", "/c", "start", `""`, `"${launchUrl}"`]
137137
: ["xdg-open", launchUrl];
138138

139139
// nosemgrep:javascript.lang.security.detect-child-process.detect-child-process
140140
const child = childProcess.spawn(command[0], command.slice(1), {
141141
stdio: "ignore",
142142
detached: true,
143+
...(process.platform === "win32" ? { shell: true } : {}),
143144
});
144145
child.on("error", (err) =>
145146
logger.error(`Failed to open browser: ${err}. URL: ${launchUrl}`),

0 commit comments

Comments
 (0)