Skip to content

Commit

Permalink
[cabal-7825] Add $CABAL env variable for external commands
Browse files Browse the repository at this point in the history
This is a follow-up of #9063
  • Loading branch information
yvan-sraka committed Nov 3, 2023
1 parent 1157461 commit 87f2ddd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Cabal/src/Distribution/Simple/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 87f2ddd

Please sign in to comment.