Skip to content

Commit

Permalink
Merge pull request #5 from alexjoedt/4-incorrect-homepath-with-sudo
Browse files Browse the repository at this point in the history
fix: wrong user home dir with sudo
  • Loading branch information
alexjoedt authored Nov 10, 2023
2 parents 2cf95b8 + 181d9b3 commit 89731fb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/grip.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ func init() {

HomePath = filepath.Join(home, ".grip")

// TODO: test on mac
sudoUser := os.Getenv("SUDO_USER")
if sudoUser != "" {
HomePath = strings.Replace(HomePath, "root", sudoUser, -1)
if sudoUser != "" && currentOS == "linux" {
HomePath = filepath.Join("/home", sudoUser, ".grip")
}

// TODO: read install path from config if config file exists
Expand Down

0 comments on commit 89731fb

Please sign in to comment.