Skip to content

Commit 7f0c24d

Browse files
committed
refactor: add urlSearch and remove options
1 parent 0abb3c3 commit 7f0c24d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/node/util.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ export const isWsl = async (
406406

407407
interface OpenOptions {
408408
args: string[]
409-
options: cp.SpawnOptions
410409
command: string
411410
urlSearch: string
412411
}
@@ -422,7 +421,6 @@ interface OpenOptions {
422421
*/
423422
export function constructOpenOptions(platform: NodeJS.Platform | "wsl", urlSearch: string): OpenOptions {
424423
const args: string[] = []
425-
const options: cp.SpawnOptions = {}
426424
let command = platform === "darwin" ? "open" : "xdg-open"
427425
if (platform === "win32" || platform === "wsl") {
428426
command = platform === "wsl" ? "cmd.exe" : "cmd"
@@ -433,7 +431,6 @@ export function constructOpenOptions(platform: NodeJS.Platform | "wsl", urlSearc
433431
return {
434432
args,
435433
command,
436-
options,
437434
urlSearch,
438435
}
439436
}
@@ -451,8 +448,9 @@ export const open = async (address: URL | string): Promise<void> => {
451448
url.hostname = "localhost"
452449
}
453450
const platform = (await isWsl(process.platform, os.release(), "/proc/version")) ? "wsl" : process.platform
454-
const { command, args, options } = constructOpenOptions(platform, url.search)
455-
const proc = cp.spawn(command, [...args, url.toString()], options)
451+
const { command, args, urlSearch } = constructOpenOptions(platform, url.search)
452+
url.search = urlSearch
453+
const proc = cp.spawn(command, [...args, url.toString()], {})
456454
await new Promise<void>((resolve, reject) => {
457455
proc.on("error", reject)
458456
proc.on("close", (code) => {

0 commit comments

Comments
 (0)