summaryrefslogtreecommitdiff
path: root/git-annex-shell.hs
diff options
context:
space:
mode:
Diffstat (limited to 'git-annex-shell.hs')
-rw-r--r--git-annex-shell.hs9
1 files changed, 3 insertions, 6 deletions
diff --git a/git-annex-shell.hs b/git-annex-shell.hs
index 12cc65e4d..57f6b2916 100644
--- a/git-annex-shell.hs
+++ b/git-annex-shell.hs
@@ -104,9 +104,6 @@ checkNotReadOnly cmd
| otherwise = checkEnv "GIT_ANNEX_SHELL_READONLY"
checkEnv :: String -> IO ()
-checkEnv var = catch check (const $ return ())
- where
- check = do
- val <- getEnv var
- when (not $ null val) $
- error $ "Action blocked by " ++ var
+checkEnv var =
+ whenM (not . null <$> catchDefaultIO (getEnv var) "") $
+ error $ "Action blocked by " ++ var