diff options
author | Joey Hess <joey@kitenet.net> | 2013-01-06 13:34:08 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-01-06 13:34:08 -0400 |
commit | d4c642e989ab10e476757dbdc48c0d5dd6b3bb8b (patch) | |
tree | b899309115f7e6d25af4ca941b0d4570a0f986d0 /Utility/UserInfo.hs | |
parent | f410b244d87cc1b2f9aa832253ee8704e369eb7f (diff) |
assistant: Detect when system is not configured with a user name, and set environment to prevent git from failing.
Diffstat (limited to 'Utility/UserInfo.hs')
-rw-r--r-- | Utility/UserInfo.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Utility/UserInfo.hs b/Utility/UserInfo.hs index bdddf4f8e..8fba3e17f 100644 --- a/Utility/UserInfo.hs +++ b/Utility/UserInfo.hs @@ -7,7 +7,8 @@ module Utility.UserInfo ( myHomeDir, - myUserName + myUserName, + myUserGecos, ) where import Control.Applicative @@ -24,6 +25,9 @@ myHomeDir = myVal ["HOME"] homeDirectory myUserName :: IO String myUserName = myVal ["USER", "LOGNAME"] userName +myUserGecos :: IO String +myUserGecos = myVal [] userGecos + myVal :: [String] -> (UserEntry -> String) -> IO String myVal envvars extract = maybe (extract <$> getpwent) return =<< check envvars where |