Skip to content

Commit

Permalink
Merge #1569
Browse files Browse the repository at this point in the history
1569: CAD-1395: LiveView, correct quitting. r=CodiePP a=denisshevchenko

This PR fixes a bug: #1454

There was a problem with terminal's state after quitting the node from the `LiveView`-mode: TUI artifacts and broken cursor. Now threads are stopping in another order, so the terminal has correct state after quitting.

Co-authored-by: Denis Shevchenko <denis.shevchenko@iohk.io>
  • Loading branch information
iohk-bors[bot] and Denis Shevchenko authored Aug 6, 2020
2 parents 39c1215 + f02d1fe commit 076a00e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cardano-node/src/Cardano/Node/TUI/EventHandler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,11 @@ eventHandler lvs (VtyEvent e) =
Vty.EvKey Vty.KEsc [] -> continue $ lvs { lvsScreen = MainView }
_ -> continue lvs
where
stopNodeThread :: MonadIO m => m ()
stopNodeThread =
stopNodeThread :: MonadIO m => m (Async ())
stopNodeThread = liftIO $ Async.async $ do
-- Because of this 100ms delay, Vty will be halted _before_ stopping node's thread.
-- It keeps the terminal in the normal state after quitting.
threadDelay 100000
case getLVThread (lvsNodeThread lvs) of
Nothing -> return ()
Just t -> liftIO $ Async.cancel t
Expand Down

0 comments on commit 076a00e

Please sign in to comment.