| Safe Haskell | Safe-Infered |
|---|
IDE.Utils.Tool
Description
Support for running external tools. Written mainly for GHCi but with | support for others in mind.
- data ToolOutput
- toolline :: ToolOutput -> String
- data ToolCommand = ToolCommand String String (Iteratee ToolOutput IO ())
- data ToolState = ToolState {}
- toolProcess :: ToolState -> IO ProcessHandle
- newToolState :: IO ToolState
- runTool :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> IO (Enumerator ToolOutput m b, ProcessHandle)
- runTool' :: FilePath -> [String] -> Maybe FilePath -> IO ([ToolOutput], ProcessHandle)
- runInteractiveTool :: ToolState -> CommandLineReader -> FilePath -> [String] -> IO ()
- newGhci :: [String] -> [String] -> Iteratee ToolOutput IO () -> IO ToolState
- newGhci' :: [String] -> Iteratee ToolOutput IO () -> IO ToolState
- executeCommand :: ToolState -> String -> String -> Iteratee ToolOutput IO () -> IO ()
- executeGhciCommand :: ToolState -> String -> Iteratee ToolOutput IO () -> IO ()
- quoteArg :: String -> String
- escapeQuotes :: String -> String
- runCommand :: String -> IO ProcessHandle
- waitForProcess :: ProcessHandle -> IO ExitCode
- interruptProcessGroupOf :: ProcessHandle -> IO ()
- data ProcessHandle
- getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode)
- runInteractiveProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO (Handle, Handle, Handle, ProcessHandle)
- runProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> Maybe Handle -> Maybe Handle -> Maybe Handle -> IO ProcessHandle
Documentation
data ToolOutput Source
Constructors
| ToolInput String | |
| ToolError String | |
| ToolOutput String | |
| ToolPrompt String | |
| ToolExit ExitCode |
Instances
toolline :: ToolOutput -> StringSource
data ToolCommand Source
Constructors
| ToolCommand String String (Iteratee ToolOutput IO ()) |
Constructors
| ToolState | |
runTool :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> IO (Enumerator ToolOutput m b, ProcessHandle)Source
runTool' :: FilePath -> [String] -> Maybe FilePath -> IO ([ToolOutput], ProcessHandle)Source
executeGhciCommand :: ToolState -> String -> Iteratee ToolOutput IO () -> IO ()Source
escapeQuotes :: String -> StringSource
runCommand :: String -> IO ProcessHandle
Runs a command using the shell.
waitForProcess :: ProcessHandle -> IO ExitCode
Waits for the specified process to terminate, and returns its exit code.
GHC Note: in order to call waitForProcess without blocking all the
other threads in the system, you must compile the program with
-threaded.
Arguments
| :: ProcessHandle | A process in the process group |
| -> IO () |
Sends an interrupt signal to the process group of the given process.
On Unix systems, it sends the group the SIGINT signal.
On Windows systems, it generates a CTRL_BREAK_EVENT and will only work for
processes created using createProcess and setting the create_group flag
data ProcessHandle
getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode)
This is a non-blocking version of waitForProcess. If the process is
still running, Nothing is returned. If the process has exited, then
is returned where Just ee is the exit code of the process.
Arguments
| :: FilePath | Filename of the executable |
| -> [String] | Arguments to pass to the executable |
| -> Maybe FilePath | Optional path to the working directory |
| -> Maybe [(String, String)] | Optional environment (otherwise inherit) |
| -> IO (Handle, Handle, Handle, ProcessHandle) |
Runs a raw command, and returns Handles that may be used to communicate
with the process via its stdin, stdout and stderr respectively.
For example, to start a process and feed a string to its stdin:
(inp,out,err,pid) <- runInteractiveProcess "..." forkIO (hPutStr inp str)
The Handles are initially in binary mode; if you need them to be
in text mode then use hSetBinaryMode.
Arguments
| :: FilePath | Filename of the executable |
| -> [String] | Arguments to pass to the executable |
| -> Maybe FilePath | Optional path to the working directory |
| -> Maybe [(String, String)] | Optional environment (otherwise inherit) |
| -> Maybe Handle | Handle to use for |
| -> Maybe Handle | Handle to use for |
| -> Maybe Handle | Handle to use for |
| -> IO ProcessHandle |
Runs a raw command, optionally specifying Handles from which to
take the stdin, stdout and stderr channels for the new
process (otherwise these handles are inherited from the current
process).
Any Handles passed to runProcess are placed immediately in the
closed state.
Note: consider using the more general createProcess instead of
runProcess.