diff options
author | Thomas Tuegel <ttuegel@gmail.com> | 2013-06-17 01:02:19 +0200 |
---|---|---|
committer | Thomas Tuegel <ttuegel@gmail.com> | 2013-06-17 01:02:19 +0200 |
commit | 309c350d6f25510c1e7944f1c6a9b86a4b521612 (patch) | |
tree | b8581662e8b45e17f04e98c648141554a1a8bef6 | |
parent | 52cce2201210c8191f3a137ccf21793810420e1f (diff) | |
download | XMonadContrib-309c350d6f25510c1e7944f1c6a9b86a4b521612.tar.gz XMonadContrib-309c350d6f25510c1e7944f1c6a9b86a4b521612.tar.xz XMonadContrib-309c350d6f25510c1e7944f1c6a9b86a4b521612.zip |
Catch exceptions when finding commands on PATH in Prompt.Shell
Ignore-this: 5a4d08c80301864bc14ed784f1054c3f
darcs-hash:20130616230219-30370-faf7ce8665584673a3d0a5a1a609eebb56ab2b66.gz
-rw-r--r-- | XMonad/Prompt/Shell.hs | 8 |
1 files changed, 2 insertions, 6 deletions
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]] |