Skip to content

Commit b52fbb4

Browse files
committed
Catch error when openssl isn't installed
1 parent 3463d56 commit b52fbb4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/vscode

Submodule vscode updated 1198 files

src/node/entry.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,16 @@ const main = async (args: Args): Promise<void> => {
4545
} else if (args.cert && !args["cert-key"]) {
4646
throw new Error("--cert-key is missing")
4747
}
48+
4849
if (!args["disable-ssh"]) {
4950
if (!options.sshHostKey && typeof options.sshHostKey !== "undefined") {
5051
throw new Error("--ssh-host-key cannot be blank")
5152
} else if (!options.sshHostKey) {
52-
options.sshHostKey = await generateSshHostKey()
53+
try {
54+
options.sshHostKey = await generateSshHostKey()
55+
} catch (error) {
56+
logger.error("Unable to start SSH server", field("error", error.message))
57+
}
5358
}
5459
}
5560

@@ -66,7 +71,7 @@ const main = async (args: Args): Promise<void> => {
6671
logger.info(`code-server ${require("../../package.json").version}`)
6772

6873
let sshPort = ""
69-
if (!args["disable-ssh"]) {
74+
if (!args["disable-ssh"] && options.sshHostKey) {
7075
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
7176
sshPort = await sshProvider.listen()
7277
}

0 commit comments

Comments
 (0)