diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-08-25 09:44:20 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-08-25 11:05:36 +0300 |
commit | 42a208d5fbed5bb4fa8d178b48625c8738b1c725 (patch) | |
tree | 4b712dc9919590ef4e4343f21b284ea6cd456bf2 /internal/linguist/linguist.go | |
parent | 890f511cf4ee2b1e78c57e590b39ebbdf0840f5e (diff) |
linguist: Fix potentially executing wrong version of `bundle`
Since 489e4eac (linguist: Use configured Git executable, 2020-08-19), we
modify git-linguist's PATH environment variable in order to have it use
the correct Git executable. This is mostly done as git-linguist doesn't
allow us to pick a Git executable, so we need prepend the real Git
executable's directory to PATH.
This hack has caused a regression, though: in case the Git directory
also contains bundle(1), then we now potentially use the wrong bundle
version and thus also the wrong version of Ruby. As a result, execution
will fail.
Fix the issue by resolving bundle to an absolute path and using that one
instead.
Diffstat (limited to 'internal/linguist/linguist.go')
-rw-r--r-- | internal/linguist/linguist.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/linguist/linguist.go b/internal/linguist/linguist.go index 523fe9e6a..44a7fd7ac 100644 --- a/internal/linguist/linguist.go +++ b/internal/linguist/linguist.go @@ -74,8 +74,13 @@ func LoadColors(cfg config.Cfg) error { } func startGitLinguist(ctx context.Context, repoPath string, commitID string, linguistCommand string) (*command.Command, error) { + bundle, err := exec.LookPath("bundle") + if err != nil { + return nil, err + } + args := []string{ - "bundle", + bundle, "exec", "bin/ruby-cd", repoPath, |