From a9a10ee0a9d82561bb4e5b844332749c2798f85b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 18 Nov 2015 12:30:01 -0400 Subject: [PATCH] improve error message when special remote program cannot be run --- Remote/External.hs | 15 +++++++++------ ...nt_6_8621bbd87982f73cf401cfa09d95d1e4._comment | 10 ++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 doc/special_remotes/ipfs/comment_6_8621bbd87982f73cf401cfa09d95d1e4._comment diff --git a/Remote/External.hs b/Remote/External.hs index 897a6a72b3..45720d4a1b 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) diff --git a/doc/special_remotes/ipfs/comment_6_8621bbd87982f73cf401cfa09d95d1e4._comment b/doc/special_remotes/ipfs/comment_6_8621bbd87982f73cf401cfa09d95d1e4._comment new file mode 100644 index 0000000000..4d547ea3b1 --- /dev/null +++ b/doc/special_remotes/ipfs/comment_6_8621bbd87982f73cf401cfa09d95d1e4._comment @@ -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.) +"""]]