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

fix: Use smarter quoting for ProxyCommand in config-ssh#3755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 9 commits intomainfrommafredri/fix-coder-configssh-proxycmd-quoting
Aug 30, 2022
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
Drop Windows tests due to different mechanism
  • Loading branch information
@mafredri
mafredri committedAug 30, 2022
commit14eacf99c19f74eac568f4f4fb06691efa69bec3
13 changes: 3 additions & 10 deletionscli/configssh_internal_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,18 +34,15 @@ func Test_sshConfigExecEscape(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

if runtime.GOOS == "windows"&& !tt.windows{
t.SkipNow()
if runtime.GOOS == "windows" {
t.Skip("Windows doesn't typically execute via /bin/sh or cmd.exe, so this test is not applicable.")
}

dir := filepath.Join(t.TempDir(), tt.path)
err := os.MkdirAll(dir, 0o755)
require.NoError(t, err)
bin := filepath.Join(dir, "coder")
contents := []byte("#!/bin/sh\necho yay\n")
if runtime.GOOS == "windows" {
contents = []byte("cls\r\n@echo off\r\necho \"yay\"\r\n")
}
err = os.WriteFile(bin, contents, 0o755) //nolint:gosec
require.NoError(t, err)

Expand All@@ -56,11 +53,7 @@ func Test_sshConfigExecEscape(t *testing.T) {
}
require.NoError(t, err)

args := []string{"/bin/sh", "-c", escaped}
if runtime.GOOS == "windows" {
args = []string{"cmd.exe", "/c", escaped}
}
b, err := exec.Command(args[0], args[1:]...).CombinedOutput() //nolint:gosec
b, err := exec.Command("/bin/sh", "-c", escaped).CombinedOutput() //nolint:gosec
require.NoError(t, err)
got := strings.TrimSpace(string(b))
require.Equal(t, "yay", got)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp