Skip to content

Commit

Permalink
[ #6194 ] Added a working directory argument to callCompiler.
Browse files Browse the repository at this point in the history
  • Loading branch information
nad committed Oct 24, 2022
1 parent 1a89181 commit f9a8ac1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/full/Agda/Compiler/CallCompiler.hs
Expand Up @@ -32,13 +32,16 @@ callCompiler
-- ^ The path to the compiler
-> [String]
-- ^ Command-line arguments.
-> Maybe FilePath
-- ^ The working directory that should be used when the compiler
-- is invoked. The default is the current working directory.
-> Maybe TextEncoding
-- ^ Use the given text encoding, if any, when reading the output
-- from the process (stdout and stderr).
-> TCM ()
callCompiler doCall cmd args enc =
callCompiler doCall cmd args cwd enc =
if doCall then do
merrors <- callCompiler' cmd args enc
merrors <- callCompiler' cmd args cwd enc
case merrors of
Nothing -> return ()
Just errors -> typeError (CompilationError errors)
Expand All @@ -52,16 +55,20 @@ callCompiler'
-- ^ The path to the compiler
-> [String]
-- ^ Command-line arguments.
-> Maybe FilePath
-- ^ The working directory that should be used when the compiler
-- is invoked. The default is the current working directory.
-> Maybe TextEncoding
-- ^ Use the given text encoding, if any, when reading the output
-- from the process (stdout and stderr).
-> TCM (Maybe String)
callCompiler' cmd args enc = do
callCompiler' cmd args cwd enc = do
reportSLn "compile.cmd" 1 $ "Calling: " ++ unwords (cmd : args)
(_, out, err, p) <-
liftIO $ createProcess
(proc cmd args) { std_err = CreatePipe
, std_out = CreatePipe
, cwd = cwd
}

-- In -v0 mode we throw away any progress information printed to
Expand Down
2 changes: 1 addition & 1 deletion src/full/Agda/Compiler/MAlonzo/Compiler.hs
Expand Up @@ -1318,4 +1318,4 @@ callGHC = do
-- those versions of GHC we don't print any progress information
-- unless an error is encountered.
let doCall = optGhcCallGhc opts
liftTCM $ callCompiler doCall ghcBin args (Just utf8)
liftTCM $ callCompiler doCall ghcBin args Nothing (Just utf8)

0 comments on commit f9a8ac1

Please sign in to comment.