use programPath consistently, not readProgramFile

Improve git-annex's ability to find the path to its program, especially
when it needs to run itself in another repo to upgrade it.

Some parts of the code used readProgramFile, probably because I forgot that
programPath exists.

I noticed this when a git-annex auto-upgrade failed because it was running
git-annex upgrade --autoonly, but the code to run git-annex used
readProgramFile, which happened to point to an older build of git-annex.
This commit is contained in:
Joey Hess 2020-03-30 16:03:44 -04:00
parent f83ead0240
commit 87d5583a91
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 38 additions and 31 deletions

View file

@ -16,7 +16,7 @@ import P2P.Annex
import Utility.Tor
import Annex.UUID
#ifndef mingw32_HOST_OS
import Config.Files
import Annex.Path
#endif
import P2P.IO
import qualified P2P.Protocol as P2P
@ -53,7 +53,7 @@ start _os = do
Nothing -> giveup "Need user-id parameter."
Just userid -> go userid
else starting "enable-tor" (ActionItemOther Nothing) $ do
gitannex <- liftIO readProgramFile
gitannex <- liftIO programPath
let ps = [Param (cmdname cmd), Param (show curruserid)]
sucommand <- liftIO $ mkSuCommand gitannex ps
maybe noop showLongNote