Skip to content

Commit d1687c1

Browse files
committed
Catch error when SSH server fails to start
1 parent f5f29c0 commit d1687c1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/node/entry.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ const main = async (args: Args): Promise<void> => {
7373
let sshPort = ""
7474
if (!args["disable-ssh"] && options.sshHostKey) {
7575
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
76-
sshPort = await sshProvider.listen()
76+
try {
77+
sshPort = await sshProvider.listen()
78+
} catch (error) {
79+
logger.warn(`SSH server: ${error.message}`)
80+
}
7781
}
7882

7983
const serverAddress = await httpServer.listen()

src/node/ssh/server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class SshProvider extends HttpProvider {
2020
this.sshServer = new ssh.Server({ hostKeys: [hostKey] }, this.handleSsh)
2121

2222
this.sshServer.on("error", (err) => {
23-
logger.error(`SSH server error: ${err.stack}`)
23+
logger.trace(`SSH server error: ${err.stack}`)
2424
})
2525
}
2626

0 commit comments

Comments
 (0)