diff options
Diffstat (limited to 'src/Process.hs')
-rw-r--r-- | src/Process.hs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Process.hs b/src/Process.hs new file mode 100644 index 0000000..f409720 --- /dev/null +++ b/src/Process.hs @@ -0,0 +1,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 |