@@ -19,7 +19,8 @@ import prettyBytes from "pretty-bytes"
1919import * as semver from "semver"
2020import * as vscode from "vscode"
2121import * as ws from "ws"
22- import { SSHConfig , defaultSSHConfigResponse , mergeSSHConfigValues } from "./sshConfig"
22+ import { SSHConfig , SSHValues , defaultSSHConfigResponse , mergeSSHConfigValues } from "./sshConfig"
23+ import { sshSupportsSetEnv } from "./sshSupport"
2324import { Storage } from "./storage"
2425
2526export class Remote {
@@ -509,7 +510,7 @@ export class Remote {
509510 }
510511
511512 const escape = ( str : string ) : string => `"${ str . replace ( / " / g, '\\"' ) } "`
512- const sshValues = {
513+ const sshValues : SSHValues = {
513514 Host : `${ Remote . Prefix } *` ,
514515 ProxyCommand : `${ escape ( binaryPath ) } vscodessh --network-info-dir ${ escape (
515516 this . storage . getNetworkInfoPath ( ) ,
@@ -520,9 +521,11 @@ export class Remote {
520521 StrictHostKeyChecking : "no" ,
521522 UserKnownHostsFile : "/dev/null" ,
522523 LogLevel : "ERROR" ,
524+ }
525+ if ( sshSupportsSetEnv ( ) ) {
523526 // This allows for tracking the number of extension
524527 // users connected to workspaces!
525- SetEnv : " CODER_SSH_SESSION_TYPE=vscode",
528+ sshValues . SetEnv = " CODER_SSH_SESSION_TYPE=vscode"
526529 }
527530
528531 await sshConfig . update ( sshValues , sshConfigOverrides )
0 commit comments