From b52fbb4cb97e65cfb3122fe2ae536f3bdc365448 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 16 Mar 2020 13:08:17 -0500 Subject: [PATCH] Catch error when openssl isn't installed --- lib/vscode | 2 +- src/node/entry.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/vscode b/lib/vscode index ae08d5460..78a4c9140 160000 --- a/lib/vscode +++ b/lib/vscode @@ -1 +1 @@ -Subproject commit ae08d5460b5a45169385ff3fd44208f431992451 +Subproject commit 78a4c91400152c0f27ba4d363eb56d2835f9903a diff --git a/src/node/entry.ts b/src/node/entry.ts index e8f43f794..ac95ad14b 100644 --- a/src/node/entry.ts +++ b/src/node/entry.ts @@ -45,11 +45,16 @@ const main = async (args: Args): Promise => { } else if (args.cert && !args["cert-key"]) { throw new Error("--cert-key is missing") } + if (!args["disable-ssh"]) { if (!options.sshHostKey && typeof options.sshHostKey !== "undefined") { throw new Error("--ssh-host-key cannot be blank") } 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 => { logger.info(`code-server ${require("../../package.json").version}`) let sshPort = "" - if (!args["disable-ssh"]) { + if (!args["disable-ssh"] && options.sshHostKey) { const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string) sshPort = await sshProvider.listen() }