summaryrefslogtreecommitdiffhomepage
path: root/src/Commands.hs
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-10-08 00:02:05 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-10-08 00:02:05 +0200
commit44f99f3ed3a6af5a2289765fadf4df29887db5c2 (patch)
tree43c779aefe8828355dfbd8399f67af10b2186808 /src/Commands.hs
parentb24a91af8d6a1f7b38012092ee786895b8b6a318 (diff)
downloadxmobar-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.hs14
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