summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Command/Run.hs9
-rw-r--r--src/Output.hs6
2 files changed, 14 insertions, 1 deletions
diff --git a/src/Command/Run.hs b/src/Command/Run.hs
index 63d1254..34a32d6 100644
--- a/src/Command/Run.hs
+++ b/src/Command/Run.hs
@@ -410,7 +410,14 @@ cmdRun (RunCommand RunOptions {..} args) = do
outputEvent output $ LogMessage $ "Jobset failed: " <> shortCid <> " " <> T.pack err
loop names (Just ( rest, next ))
- handle @SomeException (\_ -> cancelAllJobs mngr) $ do
+ handle @SomeException
+ (\e -> do
+ if | Just UserInterrupt <- fromException e
+ -> outputEvent output RunInterruptedByUser
+ | otherwise
+ -> outputMessage output $ "exception in run loop: " <> T.pack (show e)
+ cancelAllJobs mngr
+ ) $ do
loop [] =<< atomically (takeJobSource source)
waitForJobs
waitForJobs
diff --git a/src/Output.hs b/src/Output.hs
index 293f598..c50d97a 100644
--- a/src/Output.hs
+++ b/src/Output.hs
@@ -49,6 +49,7 @@ data OutputEvent
| JobIsDuplicate JobId Text
| JobPreviouslyFinished JobId Text
| JobWasSkipped JobId
+ | RunInterruptedByUser
data OutputFootnote = OutputFootnote
{ footnoteText :: Text
@@ -133,6 +134,11 @@ outputEvent out@Output {..} = liftIO . \case
forM_ outLogs $ \h -> outStrLn out h ("Skipped " <> textJobId jid)
forM_ outTest $ \h -> outStrLn out h ("job-skip " <> textJobId jid)
+ RunInterruptedByUser -> do
+ forM_ outTerminal $ \term -> void $ newLine term "\rInterrupted by user"
+ forM_ outLogs $ \h -> outStrLn out h "Interrupted by user"
+ forM_ outTest $ \h -> outStrLn out h "run-user-interrupt"
+
outputFootnote :: Output -> Text -> IO OutputFootnote
outputFootnote out@Output {..} footnoteText = do
footnoteTerminal <- forM outTerminal $ \term -> newFootnote term footnoteText