Open
This commit is contained in:
parent
943351e374
commit
bf2bd6ad54
1 changed files with 3 additions and 5 deletions
8
mod.ts
8
mod.ts
|
@ -1,5 +1,6 @@
|
|||
import { Command } from 'https://deno.land/x/cliffy@v1.0.0-rc.4/command/mod.ts'
|
||||
import { z } from 'https://deno.land/x/zod@v3.23.8/mod.ts'
|
||||
import { open } from 'https://deno.land/x/opener/mod.ts'
|
||||
|
||||
const sockets: Set<WebSocket> = new Set([])
|
||||
|
||||
|
@ -46,11 +47,8 @@ async function openBrowser(args: Args): Promise<void> {
|
|||
if (args.open) {
|
||||
// TODO: this is broken?
|
||||
const url = `http://${args.host}:${args.port}`
|
||||
console.log(`opening browser to ${url}`)
|
||||
const process = new Deno.Command('xdg-open', {
|
||||
args: [url],
|
||||
}).spawn()
|
||||
console.log(`opened browser to ${url}: ${await process.status}`)
|
||||
console.log(`Opening ${url} in web browser...`)
|
||||
await open(url)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue