summaryrefslogtreecommitdiff
path: root/app/GhcLib.hs
blob: 3c2bf600092163b6d9bf8c5e81a3fec18ecb3ebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module GhcLib (run) where

import StackWrapper (envPrefix)

import System.Environment
import System.FilePath
import System.Process

run :: String -> IO () -> IO ()
run name act = do
  args <- getArgs
  mdefaultDir <- lookupEnv $ envPrefix <> "GHC_DIR"
  case mdefaultDir of
    Just defaultDir ->
      callProcess (defaultDir </> name) args
    Nothing ->
      act