1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-04 19:45:54 +00:00
nixpkgs/pkgs/development/tools/continuous-integration/gitlab-runner/fix-shell-path.patch
Pascal Bach 335865b943 gitlab-runner, gitlab-runner_1_11: change path fix patch to work on non NixOS
It now tries to find the shell via path first and then falls back to the original
behavior.
2017-05-23 22:34:22 +02:00

25 lines
860 B
Diff

diff --git a/shells/bash.go b/shells/bash.go
index 839b7781..2b478e1e 100644
--- a/shells/bash.go
+++ b/shells/bash.go
@@ -7,6 +7,7 @@ import (
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/common"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers"
"io"
+ "os/exec"
"path"
"runtime"
"strconv"
@@ -208,7 +209,11 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (script *commo
if info.User != "" {
script.Command = "su"
if runtime.GOOS == "linux" {
- script.Arguments = append(script.Arguments, "-s", "/bin/"+b.Shell)
+ shellPath, err := exec.LookPath(b.Shell)
+ if err != nil {
+ shellPath = "/bin/"+b.Shell
+ }
+ script.Arguments = append(script.Arguments, "-s", shellPath)
}
script.Arguments = append(script.Arguments, info.User)
script.Arguments = append(script.Arguments, "-c", shellCommand)