mirror of
https://github.com/cdr/code-server.git
synced 2025-12-07 17:02:27 +01:00
Run ssh server listen after http
That way if they happen to conflict code-server doesn't crash.
This commit is contained in:
parent
6c104c016e
commit
a4c0fd1fdc
1 changed files with 10 additions and 11 deletions
|
|
@ -79,17 +79,6 @@ const main = async (args: Args): Promise<void> => {
|
|||
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<void> => {
|
|||
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue