summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-11-18 12:30:01 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-11-18 12:30:01 -0400
commit1ced111396e46137e9f0d85e2c22ee79c71e93b5 (patch)
tree2bca51552849cfa6cb6797f90506cca9cf03d829 /Remote
parent7e32cc5cdef6f74b5b2993e148398353633b0c3f (diff)
improve error message when special remote program cannot be run
Diffstat (limited to 'Remote')
-rw-r--r--Remote/External.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Remote/External.hs b/Remote/External.hs
index 897a6a72b..45720d4a1 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -369,12 +369,8 @@ startExternal :: ExternalType -> Annex ExternalState
startExternal externaltype = do
errrelayer <- mkStderrRelayer
liftIO $ do
- (Just hin, Just hout, Just herr, pid) <- createProcess $
- (proc cmd [])
- { std_in = CreatePipe
- , std_out = CreatePipe
- , std_err = CreatePipe
- }
+ (Just hin, Just hout, Just herr, pid) <-
+ createProcess p `catchIO` runerr
fileEncoding hin
fileEncoding hout
fileEncoding herr
@@ -390,6 +386,13 @@ startExternal externaltype = do
}
where
cmd = externalRemoteProgram externaltype
+ p = (proc cmd [])
+ { std_in = CreatePipe
+ , std_out = CreatePipe
+ , std_err = CreatePipe
+ }
+
+ runerr _ = error ("Cannot run " ++ cmd ++ " -- Make sure it's in your PATH and is executable.")
checkearlytermination Nothing = noop
checkearlytermination (Just exitcode) = ifM (inPath cmd)