Skip to content

Commit

Permalink
tsh: use package filepath for working with file paths (#44765)
Browse files Browse the repository at this point in the history
We were using package path to date, which assumes a path separator
of '/' and does not work correctly on Windows.
  • Loading branch information
zmb3 authored Jul 29, 2024
1 parent ef1af8e commit 8f52e54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tool/tsh/common/tsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"os"
"os/exec"
"os/signal"
"path"
"path/filepath"
"regexp"
"runtime"
"runtime/pprof"
Expand Down Expand Up @@ -596,7 +596,7 @@ func Main() {

// lets see: if the executable name is 'ssh' or 'scp' we convert
// that to "tsh ssh" or "tsh scp"
switch path.Base(os.Args[0]) {
switch filepath.Base(os.Args[0]) {
case "ssh":
cmdLine = append([]string{"ssh"}, cmdLineOrig...)
case "scp":
Expand Down Expand Up @@ -5172,10 +5172,10 @@ func serializeEnvironment(profile *client.ProfileStatus, format string) (string,
func setEnvFlags(cf *CLIConf) {
// these can only be set with env vars.
if homeDir := os.Getenv(types.HomeEnvVar); homeDir != "" {
cf.HomePath = path.Clean(homeDir)
cf.HomePath = filepath.Clean(homeDir)
}
if configPath := os.Getenv(globalTshConfigEnvVar); configPath != "" {
cf.GlobalTshConfigPath = path.Clean(configPath)
cf.GlobalTshConfigPath = filepath.Clean(configPath)
}

// prioritize CLI input for the rest.
Expand Down

0 comments on commit 8f52e54

Please sign in to comment.