Skip to content

Commit a4c0fd1

Browse files
committed
Run ssh server listen after http
That way if they happen to conflict code-server doesn't crash.
1 parent 6c104c0 commit a4c0fd1

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/node/entry.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,6 @@ const main = async (args: Args): Promise<void> => {
7979
ipcMain().onDispose(() => httpServer.dispose())
8080

8181
logger.info(`code-server ${version} ${commit}`)
82-
83-
let sshPort: number | undefined
84-
if (!args["disable-ssh"] && options.sshHostKey) {
85-
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
86-
try {
87-
sshPort = await sshProvider.listen()
88-
} catch (error) {
89-
logger.warn(`SSH server: ${error.message}`)
90-
}
91-
}
92-
9382
const serverAddress = await httpServer.listen()
9483
logger.info(`HTTP server listening on ${serverAddress}`)
9584

@@ -117,6 +106,16 @@ const main = async (args: Args): Promise<void> => {
117106

118107
logger.info(`Automatic updates are ${update.enabled ? "enabled" : "disabled"}`)
119108

109+
let sshPort: number | undefined
110+
if (!args["disable-ssh"] && options.sshHostKey) {
111+
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
112+
try {
113+
sshPort = await sshProvider.listen()
114+
} catch (error) {
115+
logger.warn(`SSH server: ${error.message}`)
116+
}
117+
}
118+
120119
if (typeof sshPort !== "undefined") {
121120
logger.info(`SSH server listening on localhost:${sshPort}`)
122121
} else {

0 commit comments

Comments
 (0)