ExitCode

Defines the exit codes that a program can return.
Defines the exit codes that a program can return.
Not on Stackage, so not searched. Monad transformer for exit codes
current status
Exception thrown by checkExitCode in the event of a non-success exit code. Note that checkExitCode is called by other functions as well, like runProcess_ or readProcess_. Note that several functions that throw an ExitCodeException intentionally do not populate eceStdout or eceStderr. This prevents unbounded memory usage for large stdout and stderrs. Functions which do include eceStdout or eceStderr (like readProcess_) state so in their documentation.
Exception thrown by checkExitCode in the event of a non-success exit code. Note that checkExitCode is called by other functions as well, like runProcess_ or readProcess_. Note that several functions that throw an ExitCodeException intentionally do not populate eceStdout or eceStderr. This prevents unbounded memory usage for large stdout and stderrs.
Get an ExitCodeException containing no data other than the exit code and process config. Unlike checkExitCode and similar, this will return an ExitCodeException even if the process exits with ExitSuccess.
Get an ExitCodeException containing the process's stdout and stderr data. Note that this will call waitExitCode to block until the process exits, if it has not exited already. Unlike checkExitCode and similar, this will return an ExitCodeException even if the process exits with ExitSuccess.
Convert an ExitCode to an Agda natural number.
This is a non-blocking version of waitForProcess. If the process is still running, Nothing is returned. If the process has exited, then Just e is returned where e is the exit code of the process. On Unix systems, see waitForProcess for the meaning of exit codes when the process died as the result of a signal. May throw UserInterrupt when using delegate_ctlc.
readCreateProcessWithExitCode works exactly like readProcessWithExitCode except that it lets you pass CreateProcess giving better flexibility. Note that Handles provided for std_in, std_out, or std_err via the CreateProcess record will be ignored.
readProcessWithExitCode is like readProcess but with two differences:
  • it returns the ExitCode of the process, and does not throw any exception if the code is not ExitSuccess.
  • it reads and returns the output from process' standard error handle, rather than the process inheriting the standard error handle.
On Unix systems, see waitForProcess for the meaning of exit codes when the process died as the result of a signal.
A version of readCreateProcessWithExitCode that communicates with the child process through a pair of CommunicationHandles. Example usage:
readCreateProcessWithExitCodeCommunicationHandle
(\(chTheyRead, chTheyWrite) -> proc "child-exe" [show chTheyRead, show chTheyWrite])
(\ hWeRead -> hGetContents hWeRead)
(\ hWeWrite -> hPut hWeWrite "xyz")
where child-exe is a separate executable that is implemented as:
main = do
[chRead, chWrite] <- getArgs
hRead  <- openCommunicationHandleRead  $ read chRead
hWrite <- openCommunicationHandleWrite $ read chWrite
input <- hGetContents hRead
hPut hWrite $ someFn input
hClose hWrite
Exit codes that a program can return with:
Execute the given command with the given arguments, returning the command's exit code.
Version of System.Process.readProcessWithExitCode that takes a key-value tuple to insert into the environment.