File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments