Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commitd7b7db4

Browse files
committed
Warn if coder-cli not in PATH on Windows
1 parent9e56e79 commitd7b7db4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

‎internal/cmd/configssh.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ func configSSH(configpath *string, remove *bool, next *bool) func(cmd *cobra.Com
136136

137137
binPath,err:=binPath()
138138
iferr!=nil {
139-
ifruntime.GOOS=="windows" {
140-
returnxerrors.Errorf("Failed to ensure `coder` is in $PATH, please move the `coder` binary to a location in $PATH (such as System32): %w",err)
141-
}
142139
returnxerrors.Errorf("Failed to get executable path: %w",err)
143140
}
144141

@@ -178,14 +175,21 @@ func binPath() (string, error) {
178175
return"",xerrors.Errorf("get executable path: %w",err)
179176
}
180177

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.
184182
ifruntime.GOOS=="windows" {
185183
binName:=filepath.Base(exePath)
186184
pathPath,err:=exec.LookPath(exePath)
187185
iferr!=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+
returnexePath,nil
189193
}
190194

191195
// Warn the user if the current executable is not the same as the one in

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp