depot/nix/pkgs/heptapod-runner/fix-shell-path.patch

25 lines
623 B
Diff
Raw Permalink Normal View History

2021-12-25 20:31:34 +00:00
diff --git a/shells/bash.go b/shells/bash.go
--- a/shells/bash.go
+++ b/shells/bash.go
@@ -5,6 +5,7 @@ import (
"bytes"
"fmt"
"io"
+ "os/exec"
"path"
"runtime"
"strconv"
@@ -249,7 +250,11 @@ func (b *BashShell) GetConfiguration(inf
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,