getUserEntryForID does not work on windows
Throw an error instead, mentioning the relevant env vars.
This commit is contained in:
parent
8f072c8db7
commit
86b326782a
2 changed files with 14 additions and 4 deletions
|
@ -48,8 +48,11 @@ myUserGecos = myVal [] userGecos
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myVal :: [String] -> (UserEntry -> String) -> IO String
|
myVal :: [String] -> (UserEntry -> String) -> IO String
|
||||||
myVal envvars extract = maybe (extract <$> getpwent) return =<< check envvars
|
myVal envvars extract = go envvars
|
||||||
where
|
where
|
||||||
check [] = return Nothing
|
#ifndef mingw32_HOST_OS
|
||||||
check (v:vs) = maybe (check vs) (return . Just) =<< getEnv v
|
go [] = extract <$> (getUserEntryForID =<< getEffectiveUserID)
|
||||||
getpwent = getUserEntryForID =<< getEffectiveUserID
|
#else
|
||||||
|
go [] = error $ "environment not set: " ++ show envvars
|
||||||
|
#endif
|
||||||
|
go (v:vs) = maybe (go vs) return =<< getEnv v
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 6"""
|
||||||
|
date="2014-10-31T16:55:47Z"
|
||||||
|
content="""
|
||||||
|
An upgrade could move the annexed objects around.
|
||||||
|
"""]]
|
Loading…
Reference in a new issue