improve error message when special remote program cannot be run

This commit is contained in:
Joey Hess 2015-11-18 12:30:01 -04:00
parent e88582ecad
commit a9a10ee0a9
Failed to extract signature
2 changed files with 19 additions and 6 deletions

View file

@ -369,12 +369,8 @@ startExternal :: ExternalType -> Annex ExternalState
startExternal externaltype = do startExternal externaltype = do
errrelayer <- mkStderrRelayer errrelayer <- mkStderrRelayer
liftIO $ do liftIO $ do
(Just hin, Just hout, Just herr, pid) <- createProcess $ (Just hin, Just hout, Just herr, pid) <-
(proc cmd []) createProcess p `catchIO` runerr
{ std_in = CreatePipe
, std_out = CreatePipe
, std_err = CreatePipe
}
fileEncoding hin fileEncoding hin
fileEncoding hout fileEncoding hout
fileEncoding herr fileEncoding herr
@ -390,6 +386,13 @@ startExternal externaltype = do
} }
where where
cmd = externalRemoteProgram externaltype 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 Nothing = noop
checkearlytermination (Just exitcode) = ifM (inPath cmd) checkearlytermination (Just exitcode) = ifM (inPath cmd)

View file

@ -0,0 +1,10 @@
[[!comment format=mdwn
username="joey"
subject="""comment 6"""
date="2015-11-18T16:22:51Z"
content="""
@rob.syme I think that error message is pretty clear: git-annex-remote-ipfs
is not present in your PATH or perhaps is not executable.
(Still, the error message could be improved a bit, doing that now.)
"""]]