Catch error when openssl isn't installed
This commit is contained in:
parent
3463d56114
commit
b52fbb4cb9
|
@ -1 +1 @@
|
||||||
Subproject commit ae08d5460b5a45169385ff3fd44208f431992451
|
Subproject commit 78a4c91400152c0f27ba4d363eb56d2835f9903a
|
|
@ -45,11 +45,16 @@ const main = async (args: Args): Promise<void> => {
|
||||||
} else if (args.cert && !args["cert-key"]) {
|
} else if (args.cert && !args["cert-key"]) {
|
||||||
throw new Error("--cert-key is missing")
|
throw new Error("--cert-key is missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args["disable-ssh"]) {
|
if (!args["disable-ssh"]) {
|
||||||
if (!options.sshHostKey && typeof options.sshHostKey !== "undefined") {
|
if (!options.sshHostKey && typeof options.sshHostKey !== "undefined") {
|
||||||
throw new Error("--ssh-host-key cannot be blank")
|
throw new Error("--ssh-host-key cannot be blank")
|
||||||
} else if (!options.sshHostKey) {
|
} else if (!options.sshHostKey) {
|
||||||
options.sshHostKey = await generateSshHostKey()
|
try {
|
||||||
|
options.sshHostKey = await generateSshHostKey()
|
||||||
|
} catch (error) {
|
||||||
|
logger.error("Unable to start SSH server", field("error", error.message))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +71,7 @@ const main = async (args: Args): Promise<void> => {
|
||||||
logger.info(`code-server ${require("../../package.json").version}`)
|
logger.info(`code-server ${require("../../package.json").version}`)
|
||||||
|
|
||||||
let sshPort = ""
|
let sshPort = ""
|
||||||
if (!args["disable-ssh"]) {
|
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()
|
sshPort = await sshProvider.listen()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue