Catch error when SSH server fails to start
This commit is contained in:
parent
f5f29c0120
commit
d1687c1533
@ -73,7 +73,11 @@ const main = async (args: Args): Promise<void> => {
|
|||||||
let sshPort = ""
|
let sshPort = ""
|
||||||
if (!args["disable-ssh"] && options.sshHostKey) {
|
if (!args["disable-ssh"] && options.sshHostKey) {
|
||||||
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
|
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()
|
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 = new ssh.Server({ hostKeys: [hostKey] }, this.handleSsh)
|
||||||
|
|
||||||
this.sshServer.on("error", (err) => {
|
this.sshServer.on("error", (err) => {
|
||||||
logger.error(`SSH server error: ${err.stack}`)
|
logger.trace(`SSH server error: ${err.stack}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user