blob: f4097200ebf6ef6c29d0316e5a22749cbfe0a190 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
module Process (
Process(..),
ProcName(..),
textProcName, unpackProcName,
) where
import Control.Concurrent.STM
import Data.Text (Text)
import qualified Data.Text as T
import System.IO
import System.Posix.Signals
import System.Process
data Process = Process
{ procName :: ProcName
, procHandle :: ProcessHandle
, procStdin :: Handle
, procOutput :: TVar [Text]
, procKillWith :: Maybe Signal
}
data ProcName = ProcName Text
| ProcNameTcpdump
| ProcNameGDB
deriving (Eq, Ord)
textProcName :: ProcName -> Text
textProcName (ProcName name) = name
textProcName ProcNameTcpdump = T.pack "tcpdump"
textProcName ProcNameGDB = T.pack "gdb"
unpackProcName :: ProcName -> String
unpackProcName = T.unpack . textProcName
|