summaryrefslogtreecommitdiffhomepage
path: root/debug-me.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-13 16:31:30 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-13 16:31:30 -0400
commit75a2a5432c284161411779a02a6f0b02f7328970 (patch)
tree1d8221bc5f582c119e4997114fe546d7870317f1 /debug-me.hs
parent26b6b0fbd304f0c14b1d973867037269b1797b91 (diff)
downloaddebug-me-75a2a5432c284161411779a02a6f0b02f7328970.tar.gz
misc minor cleanups
Diffstat (limited to 'debug-me.hs')
-rw-r--r--debug-me.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/debug-me.hs b/debug-me.hs
index c219360..44f3a38 100644
--- a/debug-me.hs
+++ b/debug-me.hs
@@ -18,16 +18,16 @@ import Data.Monoid
main :: IO ()
main = do
- exitstatus <- go
+ exitstatus <- go ">>> debug-me started"
putStrLn ""
putStrLn ">>> debug-me is exiting..."
exitWith exitstatus
where
- go = runWithPty "bash" [] $ \(p, ph) -> do
+ go startmsg = runWithPty "bash" [] $ \(p, ph) -> do
ichan <- newTChanIO
ochan <- newTChanIO
dthread <- async (developer ichan ochan)
- uthread <- async (user p ichan ochan)
+ uthread <- async (user startmsg p ichan ochan)
exitstatus <- waitForProcess ph
cancel dthread
cancel uthread
@@ -107,9 +107,9 @@ sendTtyOutput ochan devstate = go
-- missed one somehow. Ignore it?
_ -> return mempty
-user :: Pty -> TChan (Activity Entered) -> TChan (Activity Seen) -> IO ()
-user p ichan ochan = do
- let startact = StartActivity (Seen ">>> debug-me started\r\n") dummySignature
+user :: B.ByteString -> Pty -> TChan (Activity Entered) -> TChan (Activity Seen) -> IO ()
+user startmsg p ichan ochan = do
+ let startact = StartActivity (Seen (startmsg <> "\r\n")) dummySignature
atomically $ writeTChan ochan startact
backlog <- newTVarIO $ Backlog ((hash startact, startact) :| [])
_ <- sendPtyOutput p ochan backlog