Avoid a crash if getpwuid does not work, when querying the user's full name.
This commit is contained in:
parent
88c85ae609
commit
d62d81ee1c
3 changed files with 32 additions and 1 deletions
|
@ -15,6 +15,7 @@ module Utility.UserInfo (
|
|||
) where
|
||||
|
||||
import Utility.Env
|
||||
import Utility.Exception
|
||||
|
||||
import System.PosixCompat
|
||||
import Control.Applicative
|
||||
|
@ -47,7 +48,7 @@ myUserGecos :: IO (Maybe String)
|
|||
#if defined(__ANDROID__) || defined(mingw32_HOST_OS)
|
||||
myUserGecos = return Nothing
|
||||
#else
|
||||
myUserGecos = Just <$> myVal [] userGecos
|
||||
myUserGecos = catchMaybeIO $ myVal [] userGecos
|
||||
#endif
|
||||
|
||||
myVal :: [String] -> (UserEntry -> String) -> IO String
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue