improve error message when special remote program cannot be run
authorJoey Hess <joeyh@joeyh.name>
Wed, 18 Nov 2015 16:30:01 +0000 (12:30 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 18 Nov 2015 16:30:01 +0000 (12:30 -0400)
Remote/External.hs
doc/special_remotes/ipfs/comment_6_8621bbd87982f73cf401cfa09d95d1e4._comment [new file with mode: 0644]

index 897a6a72b35ddeb2408cead910a2e57d140a87c5..45720d4a1bd150565a443ea2bc0c64c6b21c97fc 100644 (file)
@@ -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 (file)
index 0000000..4d547ea
--- /dev/null
@@ -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.)
+"""]]