This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
src/Haskell/Ide/Engine/Plugin Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,10 @@ run opts = do
8383
8484 let
8585 hieBin = " hie-" ++ ghcVersion
86- backupHieBin = " hie-" ++ init (dropWhileEnd (/= ' .' ) ghcVersion)
86+ backupHieBin =
87+ case dropWhileEnd (/= ' .' ) ghcVersion of
88+ [] -> " hie"
89+ xs -> " hie-" ++ init xs
8790 candidates' = [hieBin, backupHieBin, " hie" ]
8891 candidates = map (++ exeExtension) candidates'
8992
Original file line number Diff line number Diff line change @@ -105,22 +105,27 @@ hieGhcDisplayVersion = compilerName ++ "-" ++ VERSION_ghc
105105
106106getProjectGhcVersion :: IO String
107107getProjectGhcVersion = do
108- isStackProject <- doesFileExist " stack.yaml"
108+ isStackProject <- doesFileExist " stack.yaml"
109109 isStackInstalled <- isJust <$> findExecutable " stack"
110110 if isStackProject && isStackInstalled
111111 then do
112112 L. infoM " hie" " Using stack GHC version"
113113 catch (tryCommand " stack ghc -- --numeric-version" ) $ \ e -> do
114114 L. errorM " hie" $ show (e :: SomeException )
115115 L. infoM " hie" " Couldn't find stack version, falling back to plain GHC"
116- tryCommand " ghc --numeric-version "
116+ getGhcVersion
117117 else do
118118 L. infoM " hie" " Using plain GHC version"
119- tryCommand " ghc --numeric-version "
119+ getGhcVersion
120120
121121 where
122+ getGhcVersion = do
123+ isGhcInstalled <- isJust <$> findExecutable " ghc"
124+ if isGhcInstalled
125+ then tryCommand " ghc --numeric-version"
126+ else return " No System GHC found"
127+
122128 tryCommand cmd =
123- -- Drop '\n' from the output like "7.10.3\n", "8.4.3\n"
124129 init <$> readCreateProcess (shell cmd) " "
125130
126131hieGhcVersion :: String
You can’t perform that action at this time.
0 commit comments