diff --git a/Cabal/src/Distribution/Simple/Command.hs b/Cabal/src/Distribution/Simple/Command.hs index dc2be1a698b..ae191ccc30a 100644 --- a/Cabal/src/Distribution/Simple/Command.hs +++ b/Cabal/src/Distribution/Simple/Command.hs @@ -94,6 +94,7 @@ import Distribution.ReadE import Distribution.Simple.Utils import System.Directory (findExecutable) import System.Process (callProcess) +import System.Environment (getExecutablePath, setEnv) data CommandUI flags = CommandUI { commandName :: String @@ -651,7 +652,10 @@ commandsRun globalCommand commands args = _ -> do mCommand <- findExecutable $ "cabal-" <> name case mCommand of - Just exec -> callExternal flags exec cmdArgs + Just exec -> do + execPath <- getExecutablePath + void $ setEnv "CABAL" execPath + callExternal flags exec cmdArgs Nothing -> pure $ CommandReadyToGo (flags, badCommand name) [] -> pure $ CommandReadyToGo (flags, noCommand) where