Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
Support installing multiple ghc-mod instances
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielG committed May 18, 2017
1 parent 41d3261 commit d88cd4b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
6 changes: 2 additions & 4 deletions core/Language/Haskell/GhcMod/CabalHelper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

{-# LANGUAGE CPP #-}
module Language.Haskell.GhcMod.CabalHelper
#ifndef SPEC
( getComponents
, getGhcMergedPkgOptions
, getCabalPackageDbStack
, prepareCabalHelper
, withAutogen
)
#endif
where
, withCabal
) where

import Control.Applicative
import Control.Monad
Expand Down
11 changes: 5 additions & 6 deletions core/Language/Haskell/GhcMod/Cradle.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{-# LANGUAGE CPP #-}
module Language.Haskell.GhcMod.Cradle
#ifndef SPEC
(
findCradle
( findCradle
, findCradle'
, findCradleNoLog
, findSpecCradle
, cleanupCradle
)
#endif
where

-- * for @spec@
, plainCradle
) where

import Language.Haskell.GhcMod.PathsAndFiles
import Language.Haskell.GhcMod.Monad.Types
Expand Down
30 changes: 30 additions & 0 deletions src/GHCModWrapper.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- | Dispatcher program to support co-installation of multiple ghc-mod
-- instances (compiled against different GHC versions) without breaking the
-- commandline API
module Main where

import System.IO
import System.Exit
import System.Process
import System.FilePath
import System.Environment
import Utils

import Paths_ghc_mod

main :: IO ()
main = do
args <- getArgs
libexecdir <- getLibexecDir
let installedExe = libexecdir </> "ghc-mod-real"
mexe <- mightExist installedExe
case mexe of
Nothing -> do
hPutStrLn stderr $
"ghc-mod: Could not find '"++installedExe++"', check your installation!"
exitWith $ ExitFailure 1

Just exe -> do
(_, _, _, h) <-
createProcess $ proc exe args
exitWith =<< waitForProcess h

0 comments on commit d88cd4b

Please sign in to comment.