Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Util.Process

Contents

Description

Utilities to deal with processes.

Synopsis

Documentation

supervised :: Process.CreateProcess -> IO.IO () Source #

Start a subprocess, wait for it to complete, and kill it if this thread is killed. This is like Async.withAsync, except for a subprocess, and it's hardcoded to wait for the subprocess.

TODO use Process.withCreateProcess?

multipleSupervised :: [Process.CreateProcess] -> IO.IO () Source #

Start multiple processes, and kill them all if this thread is killed.

waitAndLog :: Process.CreateProcess -> Maybe Process.ProcessHandle -> IO.IO () Source #

Wait for the process (if it started) and log if it didn't exit successfully.

call :: IO.FilePath -> [String.String] -> IO.IO () Source #

Like Process.callProcess, but log if the binary wasn't found or failed.

create :: Process.CreateProcess -> IO.IO (Maybe Handle, Maybe Handle, Maybe Handle, Maybe Process.ProcessHandle) Source #

Like Process.createProcess, but return a Nothing instead of a pid if the binary doesn't exist.

conversation

data TalkOut Source #

Constructors

Stdout !Text 
Stderr !Text 
Exit !Int 
Instances
Eq TalkOut # 
Instance details

Defined in Util.Process

Methods

(==) :: TalkOut -> TalkOut -> Bool #

(/=) :: TalkOut -> TalkOut -> Bool #

Show TalkOut # 
Instance details

Defined in Util.Process

data TalkIn Source #

Constructors

Text !Text 
EOF 
Instances
Eq TalkIn # 
Instance details

Defined in Util.Process

Methods

(==) :: TalkIn -> TalkIn -> Bool #

(/=) :: TalkIn -> TalkIn -> Bool #

Show TalkIn # 
Instance details

Defined in Util.Process

String.IsString TalkIn # 
Instance details

Defined in Util.Process

conversation :: IO.FilePath -> [String.String] -> Maybe [(String.String, String.String)] -> Chan.Chan TalkIn -> IO.IO (Chan.Chan TalkOut) Source #

Have a conversation with a subprocess. This doesn't use ptys, so this will only work if the subprocess explicitly doesn't use block buffering.

util

showt :: Show a => a -> Text Source #