未验证 提交 d1687c15 编写于 作者: A Asher

Catch error when SSH server fails to start

上级 f5f29c01
......@@ -73,7 +73,11 @@ const main = async (args: Args): Promise<void> => {
let sshPort = ""
if (!args["disable-ssh"] && options.sshHostKey) {
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
sshPort = await sshProvider.listen()
try {
sshPort = await sshProvider.listen()
} catch (error) {
logger.warn(`SSH server: ${error.message}`)
}
}
const serverAddress = await httpServer.listen()
......
......@@ -20,7 +20,7 @@ export class SshProvider extends HttpProvider {
this.sshServer = new ssh.Server({ hostKeys: [hostKey] }, this.handleSsh)
this.sshServer.on("error", (err) => {
logger.error(`SSH server error: ${err.stack}`)
logger.trace(`SSH server error: ${err.stack}`)
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册