diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-05 12:09:23 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-05 12:09:23 -0400 |
commit | d0d0d07b9e88992f8beedce33a78918e27b41a6a (patch) | |
tree | e6d8404473a702a662a0d32299cc992e4fafeeb7 /Remote/External.hs | |
parent | 362a9d87c473e0bc9b50757cd58567f3cd37d40c (diff) |
Windows: Handle shebang in external special remote program.
Diffstat (limited to 'Remote/External.hs')
-rw-r--r-- | Remote/External.hs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Remote/External.hs b/Remote/External.hs index f88b069be..13c46585b 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -21,6 +21,7 @@ import Remote.Helper.Special import Remote.Helper.ReadOnly import Remote.Helper.Messages import Utility.Metered +import Utility.Shell import Messages.Progress import Types.Transfer import Logs.PreferredContent.Raw @@ -374,7 +375,13 @@ startExternal externaltype = do errrelayer <- mkStderrRelayer g <- Annex.gitRepo liftIO $ do - p <- propgit g cmdp + (cmd, ps) <- findShellCommand basecmd + let basep = (proc cmd (toCommand ps)) + { std_in = CreatePipe + , std_out = CreatePipe + , std_err = CreatePipe + } + p <- propgit g basep (Just hin, Just hout, Just herr, pid) <- createProcess p `catchIO` runerr fileEncoding hin @@ -391,24 +398,20 @@ startExternal externaltype = do , externalPrepared = Unprepared } where - cmd = externalRemoteProgram externaltype - cmdp = (proc cmd []) - { std_in = CreatePipe - , std_out = CreatePipe - , std_err = CreatePipe - } + basecmd = externalRemoteProgram externaltype + propgit g p = do environ <- propGitEnv g return $ p { env = Just environ } - runerr _ = error ("Cannot run " ++ cmd ++ " -- Make sure it's in your PATH and is executable.") + runerr _ = error ("Cannot run " ++ basecmd ++ " -- Make sure it's in your PATH and is executable.") checkearlytermination Nothing = noop - checkearlytermination (Just exitcode) = ifM (inPath cmd) - ( error $ unwords [ "failed to run", cmd, "(" ++ show exitcode ++ ")" ] + checkearlytermination (Just exitcode) = ifM (inPath basecmd) + ( error $ unwords [ "failed to run", basecmd, "(" ++ show exitcode ++ ")" ] , do path <- intercalate ":" <$> getSearchPath - error $ cmd ++ " is not installed in PATH (" ++ path ++ ")" + error $ basecmd ++ " is not installed in PATH (" ++ path ++ ")" ) stopExternal :: External -> Annex () |