depot/third_party/nixpkgs/pkgs/by-name/gi/gitlab-runner/fix-shell-path.patch
Default email 5ca88bfbb9 Project import generated by Copybara.
GitOrigin-RevId: 9f918d616c5321ad374ae6cb5ea89c9e04bf3e58
2024-07-31 10:19:44 +00:00

25 lines
734 B
Diff

diff --git a/shells/bash.go b/shells/bash.go
index 18d608445..f158ffc0b 100644
--- a/shells/bash.go
+++ b/shells/bash.go
@@ -3,6 +3,7 @@ package shells
import (
"bytes"
"fmt"
+ "os/exec"
"path"
"runtime"
"strconv"
@@ -307,7 +308,11 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (*common.Shell
script.Command = "su"
if runtime.GOOS == OSLinux {
- script.Arguments = []string{"-s", "/bin/" + b.Shell, info.User, "-c", script.CmdLine}
+ shellPath, err := exec.LookPath(b.Shell)
+ if err != nil {
+ shellPath = "/bin/" + b.Shell
+ }
+ script.Arguments = []string{"-s", shellPath, info.User, "-c", script.CmdLine}
} else {
script.Arguments = []string{info.User, "-c", script.CmdLine}
}