From 44f99f3ed3a6af5a2289765fadf4df29887db5c2 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 8 Oct 2012 00:02:05 +0200 Subject: Fixes for warnings reported in github issue #71 --- src/Commands.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Commands.hs') 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 -- cgit v1.2.3