Skip to content

Commit

Permalink
Merge pull request #218 from DopplerHQ/detect-sudo-failure
Browse files Browse the repository at this point in the history
Print warning when doppler update fails due to lack of perms
  • Loading branch information
Piccirello authored May 25, 2021
2 parents a926672 + 7199d67 commit 89116da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/controllers/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ func RunInstallScript() (bool, string, Error) {
fmt.Println(strOut)
}
if err != nil {
return false, "", Error{Err: err, Message: "Unable to install the latest Doppler CLI"}
message := "Unable to install the latest Doppler CLI"
// check for errors indicating lack of perms
if strings.Contains(strOut, "dpkg: error: requested operation requires superuser privilege") {
message = "Error: update failed due to improper permissions\nPlease re-run with `sudo` or run as the root user"
}

return false, "", Error{Err: err, Message: message}
}

// find installed version within script output
Expand Down

0 comments on commit 89116da

Please sign in to comment.