Skip to content

Commit b04d7b5

Browse files
committed
Revert stack ghc changes to Ide.Main
1 parent d74f009 commit b04d7b5

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/Ide/Version.hs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ hlsVersion =
3838
hlsGhcDisplayVersion = compilerName ++ "-" ++ VERSION_ghc
3939

4040
data ProgramsOfInterest = ProgramsOfInterest
41-
{ cabalVersion :: Maybe Version
42-
, stackVersion :: Maybe Version
43-
, ghcVersion :: Maybe Version
44-
, stackGhcVersion :: Maybe Version
41+
{ cabalVersion :: Maybe Version
42+
, stackVersion :: Maybe Version
43+
, ghcVersion :: Maybe Version
4544
}
4645

4746
showProgramVersionOfInterest :: ProgramsOfInterest -> String
@@ -50,27 +49,26 @@ showProgramVersionOfInterest ProgramsOfInterest {..} =
5049
[ "cabal:\t\t" ++ showVersionWithDefault cabalVersion
5150
, "stack:\t\t" ++ showVersionWithDefault stackVersion
5251
, "ghc:\t\t" ++ showVersionWithDefault ghcVersion
53-
, "stack ghc:\t" ++ showVersionWithDefault stackGhcVersion
5452
]
5553
where
5654
showVersionWithDefault :: Maybe Version -> String
5755
showVersionWithDefault = maybe "Not found" showVersion
5856

5957
findProgramVersions :: IO ProgramsOfInterest
6058
findProgramVersions = ProgramsOfInterest
61-
<$> findVersionOf "cabal" ["--numeric-version"]
62-
<*> findVersionOf "stack" ["--numeric-version"]
63-
<*> findVersionOf "ghc" ["--numeric-version"]
64-
<*> findVersionOf "stack" ["ghc", "--", "--numeric-version"]
59+
<$> findVersionOf "cabal"
60+
<*> findVersionOf "stack"
61+
<*> findVersionOf "ghc"
6562

6663
-- | Find the version of the given program.
64+
-- Assumes the program accepts the cli argument "--numeric-version".
6765
-- If the invocation has a non-zero exit-code, we return 'Nothing'
68-
findVersionOf :: FilePath -> [String] -> IO (Maybe Version)
69-
findVersionOf tool args =
66+
findVersionOf :: FilePath -> IO (Maybe Version)
67+
findVersionOf tool =
7068
findExecutable tool >>= \case
7169
Nothing -> pure Nothing
7270
Just path ->
73-
readProcessWithExitCode path args "" >>= \case
71+
readProcessWithExitCode path ["--numeric-version"] "" >>= \case
7472
(ExitSuccess, sout, _) -> pure $ consumeParser myVersionParser sout
7573
_ -> pure Nothing
7674
where

0 commit comments

Comments
 (0)