diff --git a/src/node/entry.ts b/src/node/entry.ts index 88a16e81..a784338f 100644 --- a/src/node/entry.ts +++ b/src/node/entry.ts @@ -79,17 +79,6 @@ const main = async (args: Args): Promise => { ipcMain().onDispose(() => httpServer.dispose()) logger.info(`code-server ${version} ${commit}`) - - let sshPort: number | undefined - if (!args["disable-ssh"] && options.sshHostKey) { - const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string) - try { - sshPort = await sshProvider.listen() - } catch (error) { - logger.warn(`SSH server: ${error.message}`) - } - } - const serverAddress = await httpServer.listen() logger.info(`HTTP server listening on ${serverAddress}`) @@ -117,6 +106,16 @@ const main = async (args: Args): Promise => { logger.info(`Automatic updates are ${update.enabled ? "enabled" : "disabled"}`) + let sshPort: number | undefined + if (!args["disable-ssh"] && options.sshHostKey) { + const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string) + try { + sshPort = await sshProvider.listen() + } catch (error) { + logger.warn(`SSH server: ${error.message}`) + } + } + if (typeof sshPort !== "undefined") { logger.info(`SSH server listening on localhost:${sshPort}`) } else {