1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-27 20:55:25 +00:00

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:
Asher 2020-10-27 17:41:11 -05:00
parent dc177ab505
commit 504d89638b
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -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}`)
} }
} }