summaryrefslogtreecommitdiff
path: root/Utility.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-21 11:52:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-21 11:52:13 -0400
commit93a4f3d4e6970b05116fc25b8d57f0dd9d9ec675 (patch)
tree27af97e123c3b22f4eb6e19afa7bca6ec9f2891f /Utility.hs
parent1876db50f258a1a6a67d874049e93a84d34cac32 (diff)
Add --debug option. Closes: #627499
This takes advantage of the debug logging done by missingh, and I added my own debug messages for executeFile calls. There are still some other low-level ways git-annex runs stuff that are not shown by debugging, but this gets most of it easily.
Diffstat (limited to 'Utility.hs')
-rw-r--r--Utility.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Utility.hs b/Utility.hs
index 816464373..47d10ed75 100644
--- a/Utility.hs
+++ b/Utility.hs
@@ -17,6 +17,7 @@ module Utility (
relPathDirToFile,
boolSystem,
boolSystemEnv,
+ executeFile,
shellEscape,
shellUnEscape,
unsetFileMode,
@@ -39,7 +40,8 @@ module Utility (
import System.IO
import System.Exit
-import System.Posix.Process
+import qualified System.Posix.Process
+import System.Posix.Process hiding (executeFile)
import System.Posix.Signals
import System.Posix.Files
import System.Posix.Types
@@ -52,6 +54,7 @@ import Foreign (complement)
import Data.List
import Data.Maybe
import Control.Monad (liftM2, when, unless)
+import System.Log.Logger
{- A type for parameters passed to a shell command. A command can
- be passed either some Params (multiple parameters can be included,
@@ -104,6 +107,13 @@ boolSystemEnv command params env = do
restoresignals oldint oldset
executeFile command True (toCommand params) env
+{- executeFile with debug logging -}
+executeFile :: FilePath -> Bool -> [String] -> Maybe [(String, String)] -> IO a
+executeFile c path p e = do
+ debugM "Utility.executeFile" $
+ "Running: " ++ c ++ " " ++ show p ++ " " ++ maybe "" show e
+ System.Posix.Process.executeFile c path p e
+
{- Escapes a filename or other parameter to be safely able to be exposed to
- the shell. -}
shellEscape :: String -> String