mirror of
https://github.com/yudai/gotty.git
synced 2025-12-23 19:00:13 +01:00
Show error when failed to get current user
This commit is contained in:
parent
45f65bfc29
commit
39293933c5
1 changed files with 4 additions and 1 deletions
|
|
@ -53,7 +53,10 @@ func New(options Options) (*App, error) {
|
||||||
prefString := []byte{}
|
prefString := []byte{}
|
||||||
prefPath := options.ProfileFile
|
prefPath := options.ProfileFile
|
||||||
if options.ProfileFile == DefaultProfileFilePath {
|
if options.ProfileFile == DefaultProfileFilePath {
|
||||||
usr, _ := user.Current()
|
usr, err := user.Current()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
prefPath = usr.HomeDir + "/.gotty"
|
prefPath = usr.HomeDir + "/.gotty"
|
||||||
}
|
}
|
||||||
if _, err = os.Stat(prefPath); os.IsNotExist(err) {
|
if _, err = os.Stat(prefPath); os.IsNotExist(err) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue