src/node/util.ts/open
export const open = async (address: URL | string): Promise<void> => {
  if (typeof address === "string") {
    throw new Error("Cannot open socket paths")
  }
  // Web sockets do not seem to work if browsing with 0.0.0.0.
  const url = new URL(address)
  if (url.hostname === "0.0.0.0") {
    url.hostname = "localhost"
  }
  const platform = (await isWsl(process.platform, os.release(), "/proc/version")) ? "wsl" : process.platform
  const { command, args, urlSearch } = constructOpenOptions(platform, url.search)
  url.search = urlSearch
  const proc = cp.spawn(command, [...args, url.toString()], {})
  await new Promise<void>((resolve, reject) => {
    proc.on("error", reject)
    proc.on("close", (code) => {
      return code !== 0 ? reject(new Error(`Failed to open with code ${code}`)) : resolve()
    })
  })
}