mirror of https://git.tuxpa.in/a/code-server.git
Fix open line being printed when open fails
Opening the URL can fail if the user doesn't have something appropriate installed to handle it.
This commit is contained in:
parent
dc177ab505
commit
504d89638b
|
@ -162,10 +162,12 @@ const main = async (args: DefaultedArgs): Promise<void> => {
|
||||||
if (!args.socket && args.open) {
|
if (!args.socket && args.open) {
|
||||||
// The web socket doesn't seem to work if browsing with 0.0.0.0.
|
// The web socket doesn't seem to work if browsing with 0.0.0.0.
|
||||||
const openAddress = serverAddress.replace("://0.0.0.0", "://localhost")
|
const openAddress = serverAddress.replace("://0.0.0.0", "://localhost")
|
||||||
await open(openAddress).catch((error: Error) => {
|
try {
|
||||||
|
await open(openAddress)
|
||||||
|
logger.info(`Opened ${openAddress}`)
|
||||||
|
} catch (error) {
|
||||||
logger.error("Failed to open", field("address", openAddress), field("error", error))
|
logger.error("Failed to open", field("address", openAddress), field("error", error))
|
||||||
})
|
}
|
||||||
logger.info(`Opened ${openAddress}`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue