Skip to content

Commit

Permalink
Only use major version for Darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Apr 11, 2020
1 parent 5ac8f5b commit b11b74d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/GHCup/Platform.hs
Expand Up @@ -81,7 +81,11 @@ getPlatform = do
pure $ PlatformResult { _platform = Linux distro, _distroVersion = ver }
"darwin" -> do
ver <-
(either (const Nothing) Just . versioning . E.decodeUtf8)
( either (const Nothing) Just
. versioning
. getMajorVersion
. E.decodeUtf8
)
<$> getDarwinVersion
pure $ PlatformResult { _platform = Darwin, _distroVersion = ver }
"freebsd" -> do
Expand All @@ -93,10 +97,12 @@ getPlatform = do
lift $ $(logDebug) [i|Identified Platform as: #{pfr}|]
pure pfr
where
getMajorVersion = T.intercalate "." . take 2 . T.split (== '.')
getFreeBSDVersion =
liftIO $ fmap _stdOut $ executeOut [rel|freebsd-version|] [] Nothing
getDarwinVersion =
liftIO $ fmap _stdOut $ executeOut [rel|sw_vers|] ["-productVersion"] Nothing
getDarwinVersion = liftIO $ fmap _stdOut $ executeOut [rel|sw_vers|]
["-productVersion"]
Nothing


getLinuxDistro :: (MonadCatch m, MonadIO m)
Expand Down

0 comments on commit b11b74d

Please sign in to comment.