Skip to content

Commit

Permalink
Fix a bug when the system is not able to resolve current user (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
jocgir authored Feb 23, 2021
1 parent cc05c23 commit 84b616e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,8 @@ func (config TGFConfig) awsConfigExist() (result bool) {

// Otherwise, we check if the current user has a folder named .aws defined under its home directory.
awsFolderExists := false
if currentUser, err := user.Current(); err != nil {
awsFolder, err := os.Stat(filepath.Join(currentUser.HomeDir, ".aws"))
if err != nil {
if currentUser, _ := user.Current(); currentUser != nil {
if awsFolder, err := os.Stat(filepath.Join(currentUser.HomeDir, ".aws")); err == nil {
awsFolderExists = awsFolder.IsDir()
}
}
Expand Down

0 comments on commit 84b616e

Please sign in to comment.