summaryrefslogtreecommitdiff
path: root/Presence/ConsoleWriter.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/ConsoleWriter.hs')
-rw-r--r--Presence/ConsoleWriter.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Presence/ConsoleWriter.hs b/Presence/ConsoleWriter.hs
index e755b27f..986294f4 100644
--- a/Presence/ConsoleWriter.hs
+++ b/Presence/ConsoleWriter.hs
@@ -17,7 +17,6 @@ import Data.Monoid
17import Data.Char 17import Data.Char
18import Data.Maybe 18import Data.Maybe
19import System.Environment hiding (setEnv) 19import System.Environment hiding (setEnv)
20import System.Process ( rawSystem )
21import System.Exit ( ExitCode(ExitSuccess) ) 20import System.Exit ( ExitCode(ExitSuccess) )
22import System.Posix.Env ( setEnv ) 21import System.Posix.Env ( setEnv )
23import System.Posix.Process ( forkProcess, exitImmediately, executeFile ) 22import System.Posix.Process ( forkProcess, exitImmediately, executeFile )
@@ -36,7 +35,7 @@ import qualified Data.Text as Text
36import qualified Network.BSD as BSD 35import qualified Network.BSD as BSD
37 36
38import UTmp ( users2, utmp_file, UtmpRecord(..), UT_Type(..) ) 37import UTmp ( users2, utmp_file, UtmpRecord(..), UT_Type(..) )
39import FGConsole ( monitorTTY ) 38import FGConsole ( forkTTYMonitor )
40import XMPPServer ( Stanza, makePresenceStanza, JabberShow(..), stanzaType 39import XMPPServer ( Stanza, makePresenceStanza, JabberShow(..), stanzaType
41 , LangSpecificMessage(..), msgLangMap, cloneStanza, stanzaFrom ) 40 , LangSpecificMessage(..), msgLangMap, cloneStanza, stanzaFrom )
42import ControlMaybe ( handleIO_ ) 41import ControlMaybe ( handleIO_ )
@@ -109,7 +108,7 @@ onLogin cs start = \e -> do
109-- | Sets up threads to monitor tty switches and logins that are 108-- | Sets up threads to monitor tty switches and logins that are
110-- written to the system utmp file and returns a 'ConsoleWriter' 109-- written to the system utmp file and returns a 'ConsoleWriter'
111-- object for interacting with that information. 110-- object for interacting with that information.
112newConsoleWriter :: IO ConsoleWriter 111newConsoleWriter :: IO (Maybe ConsoleWriter)
113newConsoleWriter = do 112newConsoleWriter = do
114 chan <- atomically $ newEmptyTMVar 113 chan <- atomically $ newEmptyTMVar
115 cs <- atomically $ do 114 cs <- atomically $ do
@@ -136,7 +135,8 @@ newConsoleWriter = do
136 inotify <- initINotify 135 inotify <- initINotify
137 136
138 -- get active tty 137 -- get active tty
139 mtty <- monitorTTY (onTTY outvar cs) 138 mtty <- forkTTYMonitor (onTTY outvar cs)
139 forM mtty $ \_ -> do
140 atomically $ retryWhen (readTVar $ csActiveTTY cs) (==0) 140 atomically $ retryWhen (readTVar $ csActiveTTY cs) (==0)
141 141
142 -- read utmp 142 -- read utmp