diff options
| author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2012-10-08 00:02:05 +0200 | 
|---|---|---|
| committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2012-10-08 00:02:05 +0200 | 
| commit | 44f99f3ed3a6af5a2289765fadf4df29887db5c2 (patch) | |
| tree | 43c779aefe8828355dfbd8399f67af10b2186808 /src/Commands.hs | |
| parent | b24a91af8d6a1f7b38012092ee786895b8b6a318 (diff) | |
| download | xmobar-44f99f3ed3a6af5a2289765fadf4df29887db5c2.tar.gz xmobar-44f99f3ed3a6af5a2289765fadf4df29887db5c2.tar.bz2 | |
Fixes for warnings reported in github issue #71
Diffstat (limited to 'src/Commands.hs')
| -rw-r--r-- | src/Commands.hs | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/src/Commands.hs b/src/Commands.hs index b501022..a4ab5ed 100644 --- a/src/Commands.hs +++ b/src/Commands.hs @@ -23,9 +23,9 @@ module Commands      , tenthSeconds      ) where -import Prelude hiding (catch) +import Prelude  import Control.Concurrent -import Control.Exception +import Control.Exception (handle, SomeException(..))  import Data.Char  import System.Process  import System.Exit @@ -65,12 +65,12 @@ instance Exec Command where                  (i,o,e,p) <- runInteractiveCommand (unwords (prog:args))                  exit <- waitForProcess p                  let closeHandles = hClose o >> hClose i >> hClose e +                    getL = handle (\(SomeException _) -> return "") +                                  (hGetLineSafe o)                  case exit of -                  ExitSuccess -> do -                            str <- catch (hGetLineSafe o) -                                         (\(SomeException _) -> return "") -                            closeHandles -                            cb str +                  ExitSuccess -> do str <- getL +                                    closeHandles +                                    cb str                    _ -> do closeHandles                            cb $ "Could not execute command " ++ prog | 
