summaryrefslogtreecommitdiff
path: root/src/Command/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-11-11 23:10:04 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2026-11-12 20:27:03 +0100
commita48ad38476fdda3b38384cc9ced60414d7e316df (patch)
treec50c8cbf94aca1a9324a08f2277c330f63029ce5 /src/Command/Run.hs
parent637e74452ef6a92bd6622eb6f46f7a3c183ef195 (diff)
Task status of duplicate jobs without extra TVar
Diffstat (limited to 'src/Command/Run.hs')
-rw-r--r--src/Command/Run.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Command/Run.hs b/src/Command/Run.hs
index 52005db..72dd4e2 100644
--- a/src/Command/Run.hs
+++ b/src/Command/Run.hs
@@ -463,13 +463,13 @@ showStatus width blink ( status, fnotes ) = case status of
showNotes w = fitToLength w $ T.concat $ " " : map showNote fnotes
showNote fnote = "[" <> T.pack (maybe "?" (show . tfNumber) (footnoteTerminal fnote)) <> "]"
-displayStatusLine :: TerminalOutput -> TerminalLine -> Text -> Text -> [ Maybe (TVar ( JobStatus JobOutput, [ OutputFootnote ] )) ] -> IO ()
+displayStatusLine :: TerminalOutput -> TerminalLine -> Text -> Text -> [ Maybe (STM ( JobStatus JobOutput, [ OutputFootnote ] )) ] -> IO ()
displayStatusLine tout line prefix1 prefix2 statuses = do
go "\0"
where
go prev = do
( ss, cur ) <- atomically $ do
- sns <- mapM (sequence . fmap readTVar) statuses
+ sns <- mapM sequence statuses
blink <- terminalBlinkStatus tout
let cur = T.concat $ map (maybe " " ((" " <>) . showStatus 7 blink)) sns
when (cur == prev) retry
@@ -484,9 +484,9 @@ displayStatusLine tout line prefix1 prefix2 statuses = do
then return ()
else go cur
-waitForJobStatuses :: [ Maybe (TVar ( JobStatus a, [ OutputFootnote ] )) ] -> IO ()
+waitForJobStatuses :: [ Maybe (STM ( JobStatus a, [ OutputFootnote ] )) ] -> IO ()
waitForJobStatuses mbstatuses = do
let statuses = catMaybes mbstatuses
atomically $ do
- ss <- mapM readTVar statuses
+ ss <- sequence statuses
when (any (not . jobStatusFinished . fst) ss) retry