From 309c350d6f25510c1e7944f1c6a9b86a4b521612 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Mon, 17 Jun 2013 01:02:19 +0200 Subject: Catch exceptions when finding commands on PATH in Prompt.Shell Ignore-this: 5a4d08c80301864bc14ed784f1054c3f darcs-hash:20130616230219-30370-faf7ce8665584673a3d0a5a1a609eebb56ab2b66.gz --- XMonad/Prompt/Shell.hs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'XMonad/Prompt') diff --git a/XMonad/Prompt/Shell.hs b/XMonad/Prompt/Shell.hs index 5c8f687..5f3a06d 100644 --- a/XMonad/Prompt/Shell.hs +++ b/XMonad/Prompt/Shell.hs @@ -33,7 +33,7 @@ import Codec.Binary.UTF8.String (encodeString) import Control.Exception as E import Control.Monad (forM) import Data.List (isPrefixOf) -import System.Directory (doesDirectoryExist, getDirectoryContents) +import System.Directory (getDirectoryContents) import System.Environment (getEnv) import System.Posix.Files (getFileStatus, isDirectory) @@ -113,11 +113,7 @@ getCommands :: IO [String] getCommands = do p <- getEnv "PATH" `E.catch` econst [] let ds = filter (/= "") $ split ':' p - es <- forM ds $ \d -> do - exists <- doesDirectoryExist d - if exists - then getDirectoryContents d - else return [] + es <- forM ds $ \d -> getDirectoryContents d `E.catch` econst [] return . uniqSort . filter ((/= '.') . head) . concat $ es split :: Eq a => a -> [a] -> [[a]] -- cgit v1.2.3