diff --git a/cabal-install/src/Distribution/Client/CmdExec.hs b/cabal-install/src/Distribution/Client/CmdExec.hs index 17396d38a98..82fada98463 100644 --- a/cabal-install/src/Distribution/Client/CmdExec.hs +++ b/cabal-install/src/Distribution/Client/CmdExec.hs @@ -268,6 +268,7 @@ withTempEnvFile verbosity baseCtx buildCtx buildStatus action = do action envOverrides ) +-- | Get paths to all dependency executables to be included in PATH. pathAdditions :: ProjectBaseContext -> ProjectBuildContext -> [FilePath] pathAdditions ProjectBaseContext{..} ProjectBuildContext{..} = paths ++ cabalConfigPaths @@ -281,6 +282,7 @@ pathAdditions ProjectBaseContext{..} ProjectBuildContext{..} = S.toList $ binDirectories distDirLayout elaboratedShared elaboratedPlanToExecute +-- | Get paths to all dependency executables to be included in PATH. binDirectories :: DistDirLayout -> ElaboratedSharedConfig diff --git a/cabal-install/src/Distribution/Client/CmdRun.hs b/cabal-install/src/Distribution/Client/CmdRun.hs index ed66b74aff3..b390dacb22e 100644 --- a/cabal-install/src/Distribution/Client/CmdRun.hs +++ b/cabal-install/src/Distribution/Client/CmdRun.hs @@ -60,6 +60,7 @@ import Distribution.Client.ProjectPlanning ) import Distribution.Client.ProjectPlanning.Types ( dataDirsEnvironmentForPlan + , elabExeDependencyPaths ) import Distribution.Client.ScriptUtils ( AcceptNoTargets (..) @@ -302,11 +303,13 @@ runAction flags@NixStyleFlags{..} targetAndArgs globalFlags = || buildSettingOnlyDownload (buildSettings baseCtx) let extraPath = - fromNubList - . projectConfigProgPathExtra - . projectConfigShared - . projectConfig - $ baseCtx + elabExeDependencyPaths pkg + ++ ( fromNubList + . projectConfigProgPathExtra + . projectConfigShared + . projectConfig + $ baseCtx + ) logExtraProgramSearchPath verbosity extraPath diff --git a/changelog.d/pr-9341 b/changelog.d/pr-9341 new file mode 100644 index 00000000000..dc6c65a802d --- /dev/null +++ b/changelog.d/pr-9341 @@ -0,0 +1,11 @@ +synopsis: Fix run command environment +packages: cabal-install +prs: #9341 +issues: #8391 + +description: { + +- The Run command will now add binary paths of dependencies + (build-tool-depends) to PATH, just like Exec and Test commands. + +} \ No newline at end of file