diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-01-14 20:16:55 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-01-14 20:34:19 +0100 |
commit | d81cbaafde66f4b96af2f01ba56743089fd87c77 (patch) | |
tree | 0cc5590da7c43542ccb83a2fdd619c0fdde8b522 /src/Command/Run.hs | |
parent | 03b5f52091a6a25218911255eb00439384bd24c4 (diff) |
Common blink var for whole terminal output
Diffstat (limited to 'src/Command/Run.hs')
-rw-r--r-- | src/Command/Run.hs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/Command/Run.hs b/src/Command/Run.hs index bd2aba9..403e8b8 100644 --- a/src/Command/Run.hs +++ b/src/Command/Run.hs @@ -113,19 +113,14 @@ showStatus blink = \case displayStatusLine :: TerminalOutput -> Text -> Text -> [ Maybe (TVar (JobStatus JobOutput)) ] -> IO () displayStatusLine tout prefix1 prefix2 statuses = do - blinkVar <- newTVarIO False - t <- forkIO $ forever $ do - threadDelay 500000 - atomically $ writeTVar blinkVar . not =<< readTVar blinkVar line <- newLine tout "" void $ forkIO $ do - go line blinkVar "\0" - killThread t + go line "\0" where - go line blinkVar prev = do + go line prev = do (ss, cur) <- atomically $ do ss <- mapM (sequence . fmap readTVar) statuses - blink <- readTVar blinkVar + blink <- terminalBlinkStatus tout let cur = T.concat $ map (maybe " " ((" " <>) . showStatus blink)) ss when (cur == prev) retry return (ss, cur) @@ -137,4 +132,4 @@ displayStatusLine tout prefix1 prefix2 statuses = do if all (maybe True jobStatusFinished) ss then return () - else go line blinkVar cur + else go line cur |