about summary refs log tree commit diff
path: root/pkgs/development/tools/continuous-integration/gitlab-runner/fix-shell-path.patch
blob: 4a3d37be09cd4f0936cdfd4e66d7a8ac026859e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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,