GHC.SysTools.Process

ghc-9.10.0.20240328: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.SysTools.Process

Synopsis

- enableProcessJobs :: CreateProcess -> CreateProcess
- readCreateProcessWithExitCode' :: CreateProcess -> IO (ExitCode, String)
- replaceVar :: (String, String) -> [(String, String)] -> [(String, String)]
- readProcessEnvWithExitCode :: String -> [String] -> (String, String) -> IO (ExitCode, String, String)
- c_locale_env :: (String, String)
- getGccEnv :: [Option] -> IO (Maybe [(String, String)])
- runSomething :: Logger -> String -> String -> [Option] -> IO ()
- runSomethingResponseFile :: Logger -> TmpFs -> TempDir -> (String -> String) -> String -> String -> [Option] -> Maybe [(String, String)] -> IO ()
- runSomethingFiltered :: Logger -> (String -> String) -> String -> String -> [Option] -> Maybe FilePath -> Maybe [(String, String)] -> IO ()
- runSomethingWith :: Logger -> String -> String -> [Option] -> ([String] -> IO (ExitCode, a)) -> IO a
- handleProc :: String -> String -> IO (ExitCode, r) -> IO r
- builderMainLoop :: Logger -> (String -> String) -> FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO ExitCode
- readerProc :: Chan BuildMessage -> Handle -> (String -> String) -> IO ()
- parseError :: String -> Maybe (String, Int, Int, String)
- breakColon :: String -> Maybe (String, String)
- breakIntColon :: String -> Maybe (Int, String)
- data BuildMessage
  - = BuildMsg !SDoc
  - | BuildError !SrcLoc !SDoc
  - | EOF
- linesPlatform :: String -> [String]

# Documentation

enableProcessJobs :: CreateProcess -> CreateProcess Source #

Enable process jobs support on Windows if it can be expected to work (e.g. `process >= 1.6.9.0`).

readCreateProcessWithExitCode' Source #

Arguments

:: CreateProcess |
-> IO (ExitCode, String) | stdout

replaceVar :: (String, String) -> [(String, String)] -> [(String, String)] Source #

readProcessEnvWithExitCode Source #

Arguments

:: String | program path
-> [String] | program args
-> (String, String) | addition to the environment
-> IO (ExitCode, String, String) | (exit_code, stdout, stderr)

Version of `System.Process.readProcessWithExitCode` that takes a key-value tuple to insert into the environment.

c_locale_env :: (String, String) Source #

getGccEnv :: [Option] -> IO (Maybe [(String, String)]) Source #

runSomething :: Logger -> String -> String -> [Option] -> IO () Source #

runSomethingResponseFile :: Logger -> TmpFs -> TempDir -> (String -> String) -> String -> String -> [Option] -> Maybe [(String, String)] -> IO () Source #

Run a command, placing the arguments in an external response file.

This command is used in order to avoid overlong command line arguments on Windows. The command line arguments are first written to an external, temporary response file, and then passed to the linker via @filepath. response files for passing them in. See:

https://gcc.gnu.org/wiki/Response_Files https://gitlab.haskell.org/ghc/ghc/issues/10777

runSomethingFiltered :: Logger -> (String -> String) -> String -> String -> [Option] -> Maybe FilePath -> Maybe [(String, String)] -> IO () Source #

runSomethingWith :: Logger -> String -> String -> [Option] -> ([String] -> IO (ExitCode, a)) -> IO a Source #

handleProc :: String -> String -> IO (ExitCode, r) -> IO r Source #

builderMainLoop :: Logger -> (String -> String) -> FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO ExitCode Source #

readerProc :: Chan BuildMessage -> Handle -> (String -> String) -> IO () Source #

parseError :: String -> Maybe (String, Int, Int, String) Source #

breakColon :: String -> Maybe (String, String) Source #

Break a line of an error message into a filename and the rest of the line, taking care to ignore colons in Windows drive letters (as noted in #17786). For instance,

- `"hi.c: ABCD"` is mapped to `Just ("hi.c", "ABCD")`
- `"C:\hi.c: ABCD"` is mapped to `Just ("C:\hi.c", "ABCD")`

breakIntColon :: String -> Maybe (Int, String) Source #

data BuildMessage Source #

Constructors

BuildMsg !SDoc |
BuildError !SrcLoc !SDoc |
EOF |

linesPlatform :: String -> [String] Source #