depot/third_party/nixpkgs/pkgs/development/tools/continuous-integration/gitlab-runner/fix-shell-path.patch

26 lines
706 B
Diff
Raw Normal View History

diff --git a/shells/bash.go b/shells/bash.go
index bd99eca1a..9873dff6b 100644
--- a/shells/bash.go
+++ b/shells/bash.go
@@ -3,6 +3,7 @@ package shells
import (
"bytes"
"fmt"
+ "os/exec"
"path"
"runtime"
"strconv"
@@ -300,7 +301,11 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (*common.Shell
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,