Skip to content

Commit

Permalink
use /bin/bash instead of /bin/sh for venv
Browse files Browse the repository at this point in the history
  • Loading branch information
karakanb committed Dec 12, 2023
1 parent 63bfe68 commit e2bbfe0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/python/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (l *localPythonRunner) Run(ctx context.Context, execCtx *executionContext)
}
fullCommand := fmt.Sprintf("source %s/bin/activate && echo 'activated virtualenv' && python3 -u -m %s", depsPath, execCtx.module)
return l.cmd.Run(ctx, execCtx.repo, &command{
Name: "/bin/sh",
Name: Shell,
Args: []string{"-c", fullCommand},
EnvVars: execCtx.envVariables,
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/python/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func Test_localPythonRunner_Run(t *testing.T) {

cmd := new(mockCmd)
cmd.On("Run", mock.Anything, repo, &command{
Name: "/bin/sh",
Name: Shell,
Args: []string{"-c", expectedCommand},
}).Return(assert.AnError)

Expand All @@ -154,7 +154,7 @@ func Test_localPythonRunner_Run(t *testing.T) {

cmd := new(mockCmd)
cmd.On("Run", mock.Anything, repo, &command{
Name: "/bin/sh",
Name: Shell,
Args: []string{"-c", expectedCommand},
}).Return(nil)

Expand Down
4 changes: 3 additions & 1 deletion pkg/python/venv.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type installReqsToHomeDir struct {
lock sync.Mutex
}

const Shell = "/bin/bash"

func (i *installReqsToHomeDir) EnsureVirtualEnvExists(ctx context.Context, repo *git.Repo, requirementsTxt string) (string, error) {
err := i.config.EnsureVirtualenvDirExists()
if err != nil {
Expand Down Expand Up @@ -69,7 +71,7 @@ func (i *installReqsToHomeDir) EnsureVirtualEnvExists(ctx context.Context, repo

fullCommand := fmt.Sprintf("source %s/bin/activate && pip3 install -r %s --quiet --quiet && echo 'installed all the dependencies'", venvPath, requirementsTxt)
err = i.cmd.Run(ctx, repo, &command{
Name: "/bin/sh",
Name: Shell,
Args: []string{"-c", fullCommand},
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/python/venv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func Test_installReqsToHomeDir_EnsureVirtualEnvExists(t *testing.T) {
Args: []string{"-m", "venv", "/path/to/venv"},
}).Return(nil)
fakeCmd.On("Run", mock.Anything, repo, &command{
Name: "/bin/sh",
Name: Shell,
Args: []string{"-c", "source /path/to/venv/bin/activate && pip3 install -r /path1/requirements.txt --quiet --quiet && echo 'installed all the dependencies'"},
}).Return(nil)

Expand Down

0 comments on commit e2bbfe0

Please sign in to comment.