Hoogle Search
Within LTS Haskell 24.32 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
stm Control.Concurrent.STM.TVar No documentation available.
readCreateProcess :: CreateProcess -> String -> IO Stringprocess System.Process readCreateProcess works exactly like readProcess except that it lets you pass CreateProcess giving better flexibility.
> readCreateProcess ((shell "pwd") { cwd = Just "/etc/" }) "" "/etc\n"Note that Handles provided for std_in or std_out via the CreateProcess record will be ignored.readCreateProcessWithExitCode :: CreateProcess -> String -> IO (ExitCode, String, String)process System.Process 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.
readProcess :: FilePath -> [String] -> String -> IO Stringprocess System.Process readProcess forks an external process, reads its standard output strictly, blocking until the process terminates, and returns the output string. The external process inherits the standard error. If an asynchronous exception is thrown to the thread executing readProcess, the forked process will be terminated and readProcess will wait (block) until the process has been terminated. Output is returned strictly, so this is not suitable for launching processes that require interaction over the standard file streams. This function throws an IOError if the process ExitCode is anything other than ExitSuccess. If instead you want to get the ExitCode then use readProcessWithExitCode. Users of this function should compile with -threaded if they want other Haskell threads to keep running while waiting on the result of readProcess.
> readProcess "date" [] [] "Thu Feb 7 10:03:39 PST 2008\n"
The arguments are:- The command to run, which must be in the $PATH, or an absolute or relative path
- A list of separate command line arguments to the program. See RawCommand for further discussion of Windows semantics.
- A string to pass on standard input to the forked process.
readProcessWithExitCode :: FilePath -> [String] -> String -> IO (ExitCode, String, String)process System.Process 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.
-
process System.Process.CommunicationHandle 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
readArray :: PrimMonad m => MutableArray (PrimState m) a -> Int -> m aprimitive Data.Primitive.Array Read a value from the array at the given index. Note: this function does not do bounds checking.
readByteArray :: (Prim a, PrimMonad m) => MutableByteArray (PrimState m) -> Int -> m aprimitive Data.Primitive.ByteArray Read a primitive value from the byte array. The offset is given in elements of type a rather than in bytes. Note: this function does not do bounds checking.
readCharArray :: PrimMonad m => MutableByteArray (PrimState m) -> Int -> m Charprimitive Data.Primitive.ByteArray Read an 8-bit element from the byte array, interpreting it as a Latin-1-encoded character. The offset is given in bytes. Note: this function does not do bounds checking.
readMVar :: PrimMonad m => MVar (PrimState m) a -> m aprimitive Data.Primitive.MVar Atomically read the contents of an MVar. If the MVar is currently empty, readMVar will wait until it is full. readMVar is guaranteed to receive the next putMVar. Multiple Wakeup: readMVar is multiple-wakeup, so when multiple readers are blocked on an MVar, all of them are woken up at the same time.