-
-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more portable way of getting hostname in Layout.OnHost #899
Comments
The commit log may be of interest (it looks like I added this before we moved to GitHub, so there's no PR and the commit description is a little wonky):
The |
Would shelling out really be that much of a pain in terms of portability? I'd guess (well, hope :)) that all systems we still support have a In either case, the relevant code in that package seems to small (most of it is MS Windows stuff) that vendoring sounds like a better option to me, should we choose to go down that route: type HostName = String
foreign import ccall unsafe "gethostname" gethostname :: CString -> CSize -> IO CInt
getHostName :: IO HostName
getHostName = allocaArray0 size $ \cstr -> do
throwErrnoIfMinus1_ "getHostName" $ gethostname cstr (fromIntegral size)
peekCString cstr
where size = 256 |
Probably re vendoring. Back then there were issues both with getting a hostname (on some systems you had to parse |
It seems like it currently only checks for the
HOST
environment variable. It would be nice if it could check/etc/hostname
or other environment variables.Maybe use
Network.HostName
? https://hackage.haskell.org/package/hostname-1.0/docs/src/Network-HostName.html#getHostNamexmonad-contrib/XMonad/Layout/OnHost.hs
Line 119 in eb72684
The text was updated successfully, but these errors were encountered: