8ac5e011d6
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
28 lines
778 B
Diff
28 lines
778 B
Diff
diff --git a/shells/bash.go b/shells/bash.go
|
|
index 673f4765..a58cc5e2 100644
|
|
--- a/shells/bash.go
|
|
+++ b/shells/bash.go
|
|
@@ -5,6 +5,7 @@ import (
|
|
"bytes"
|
|
"fmt"
|
|
"io"
|
|
+ "os/exec"
|
|
"path"
|
|
"runtime"
|
|
"strconv"
|
|
@@ -225,7 +226,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)
|
|
--
|
|
2.18.0
|
|
|