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> => {
45
45
} else if ( args . cert && ! args [ "cert-key" ] ) {
46
46
throw new Error ( "--cert-key is missing" )
47
47
}
48
+
48
49
if ( ! args [ "disable-ssh" ] ) {
49
50
if ( ! options . sshHostKey && typeof options . sshHostKey !== "undefined" ) {
50
51
throw new Error ( "--ssh-host-key cannot be blank" )
51
52
} 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
+ }
53
58
}
54
59
}
55
60
@@ -66,7 +71,7 @@ const main = async (args: Args): Promise<void> => {
66
71
logger . info ( `code-server ${ require ( "../../package.json" ) . version } ` )
67
72
68
73
let sshPort = ""
69
- if ( ! args [ "disable-ssh" ] ) {
74
+ if ( ! args [ "disable-ssh" ] && options . sshHostKey ) {
70
75
const sshProvider = httpServer . registerHttpProvider ( "/ssh" , SshProvider , options . sshHostKey as string )
71
76
sshPort = await sshProvider . listen ( )
72
77
}
You can’t perform that action at this time.
0 commit comments