diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2021-11-26 22:34:40 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2021-11-26 22:34:40 +0100 |
commit | 5c5eda9e8333bd652d0ea9cdbeb6fc4d5bdfe5b7 (patch) | |
tree | e94e509972a2e73d62ba78ddb1d55cdda4a1fd91 /src/Process.hs | |
parent | b03a763688267781cb252681679ac8e11b03c479 (diff) |
Separate constructors for internal process names
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 |