@@ -94,8 +94,9 @@ data Vty = Vty
94 -- | Clean up after vty. A call to this function is necessary to
94 -- | Clean up after vty. A call to this function is necessary to
95 -- cleanly restore the terminal state before application exit. The
95 -- cleanly restore the terminal state before application exit. The
96 -- above methods will throw an exception if executed after this is
96 -- above methods will throw an exception if executed after this is
97− -- executed.
97+ -- executed. Idempotent.
98 , shutdown :: IO ()
98 , shutdown :: IO ()
99+ , isShutdown :: IO Bool
101-- | Create a Vty handle. At most one handle should be created at a time
102-- | Create a Vty handle. At most one handle should be created at a time
@@ -125,6 +126,8 @@ intMkVty input out = do
125 releaseDisplay out
126 releaseDisplay out
126 releaseTerminal out
127 releaseTerminal out
129+ let shutdownStatus = atomically $ readTVar shutdownVar
128 lastPicRef <- newIORef Nothing
131 lastPicRef <- newIORef Nothing
129 lastUpdateRef <- newIORef Nothing
132 lastUpdateRef <- newIORef Nothing
@@ -175,4 +178,5 @@ intMkVty input out = do
175 , outputIface = out
178 , outputIface = out
176 , refresh = innerRefresh
179 , refresh = innerRefresh
177 , shutdown = shutdownIo
180 , shutdown = shutdownIo
181+ , isShutdown = shutdownStatus