@@ -136,9 +136,6 @@ func configSSH(configpath *string, remove *bool, next *bool) func(cmd *cobra.Com
136
136
137
137
binPath , err := binPath ()
138
138
if err != nil {
139
- if runtime .GOOS == "windows" {
140
- return xerrors .Errorf ("Failed to ensure `coder` is in $PATH, please move the `coder` binary to a location in $PATH (such as System32): %w" , err )
141
- }
142
139
return xerrors .Errorf ("Failed to get executable path: %w" , err )
143
140
}
144
141
@@ -178,14 +175,21 @@ func binPath() (string, error) {
178
175
return "" , xerrors .Errorf ("get executable path: %w" , err )
179
176
}
180
177
181
- // On Windows, the coder-cli executable must be in $PATH for Msys2 and Git
182
- // Bash to function correctly. To prevent weird behavior when people switch
183
- // between the two, we require this for all users.
178
+ // On Windows, the coder-cli executable must be in $PATH for both Msys2/Git
179
+ // Bash and OpenSSH for Windows (used by Powershell and VS Code) to function
180
+ // correctly. Check if the current executable is in $PATH, and warn the user
181
+ // if it isn't.
184
182
if runtime .GOOS == "windows" {
185
183
binName := filepath .Base (exePath )
186
184
pathPath , err := exec .LookPath (exePath )
187
185
if err != nil {
188
- return "" , xerrors .Errorf ("locate %q in $PATH: %w" , binName , err )
186
+ clog .LogWarn (
187
+ "The current executable is not in $PATH." ,
188
+ "This may lead to problems connecting to your workspace via SSH." ,
189
+ fmt .Sprintf ("Please move %q to a location in your $PATH (such as System32) and run `%s config-ssh` again." , binName , binName ),
190
+ )
191
+ // Return the exePath so SSH at least works outside of Msys2.
192
+ return exePath , nil
189
193
}
190
194
191
195
// Warn the user if the current executable is not the same as the one in
0 commit comments