Skip to content

Commit

Permalink
Address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
jpm-canonical committed Aug 30, 2024
1 parent 02a16b0 commit 0bf05f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/thread_tests/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ func remote_exec(t *testing.T, command string) string {

// Remote commands that require sudo might ask for the password. Always pass it in. See https://stackoverflow.com/a/11955358
if strings.HasPrefix(command, "sudo ") {
command = command[5:]
command = strings.TrimPrefix(command, "sudo ")
escapedPassword := strings.Replace(remotePassword, "\"", "\\\"", -1)
command = "echo \"" + escapedPassword + "\" | sudo -S " + command
command = fmt.Sprintf(`echo "%s" | sudo -S %s`, escapedPassword, command)
}

if SSHClient == nil {
Expand Down

0 comments on commit 0bf05f3

Please sign in to comment.