diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2019-09-28 10:39:00 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2019-09-28 10:39:00 -0700 |
commit | 242d993ca9e633a840e8a60c566eba02f9a8cad2 (patch) | |
tree | e5431cccd39d837520e25516affd136faf6fde61 /ControlWindow.hs | |
parent | 11fe553b8cb6e2aa9bb24ce4f9e4879a58cef6de (diff) | |
parent | 5a818996271da687a21fd6e8d315c4a48ed4bc45 (diff) | |
download | debug-me-242d993ca9e633a840e8a60c566eba02f9a8cad2.tar.gz |
Merge tag '1.20190926'
tagging package debug-me version 1.20190926
# gpg: Signature made Thu 26 Sep 2019 05:05:32 PM MST
# gpg: using RSA key 28A500C35207EAB72F6C0F25DB12DB0FF05F8F38
# gpg: Good signature from "Joey Hess <joeyh@joeyh.name>" [full]
# Primary key fingerprint: E85A 5F63 B31D 24C1 EBF0 D81C C910 D922 2512 E3C7
# Subkey fingerprint: 28A5 00C3 5207 EAB7 2F6C 0F25 DB12 DB0F F05F 8F38
Diffstat (limited to 'ControlWindow.hs')
-rw-r--r-- | ControlWindow.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ControlWindow.hs b/ControlWindow.hs index bd79d0f..29c81c9 100644 --- a/ControlWindow.hs +++ b/ControlWindow.hs @@ -98,9 +98,20 @@ type Response = String type PromptChan = TChan Prompt type ResponseChan = TChan Response +-- | Get a name for the debug-me user. When possible this will be the +-- actual username, but failing that, anything reasonable will do, +-- since it's only ever displayed to the person they are communicating +-- with. +getUserName :: IO String +getUserName = do + loginname <- try getLoginName :: IO (Either SomeException String) + case loginname of + Right n -> return n + Left _ -> return "user" + collectOutput :: TMChan ControlOutput -> PromptChan -> ResponseChan -> IO () collectOutput ochan promptchan responsechan = do - myusername <- fromString <$> getLoginName + myusername <- fromString <$> getUserName loop myusername where loop myusername = do |