Skip to content

Commit 2c32101

Browse files
authored
Use interactive shell for running shell commands only if shell is bash or zsh (#4159)
- **PR Description** Fix running shell commands with fish or nushell. Fixes #4153.
2 parents b8d5e48 + dbd407c commit 2c32101

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pkg/commands/oscommands/os_default_platform.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,29 @@ package oscommands
66
import (
77
"os"
88
"runtime"
9+
"strings"
910
)
1011

1112
func GetPlatform() *Platform {
13+
shell := getUserShell()
14+
15+
interactiveShell := shell
16+
interactiveShellArg := "-i"
17+
interactiveShellExit := "; exit $?"
18+
19+
if !(strings.HasSuffix(shell, "bash") || strings.HasSuffix(shell, "zsh")) {
20+
interactiveShell = "bash"
21+
interactiveShellArg = ""
22+
interactiveShellExit = ""
23+
}
24+
1225
return &Platform{
1326
OS: runtime.GOOS,
1427
Shell: "bash",
15-
InteractiveShell: getUserShell(),
28+
InteractiveShell: interactiveShell,
1629
ShellArg: "-c",
17-
InteractiveShellArg: "-i",
18-
InteractiveShellExit: "; exit $?",
30+
InteractiveShellArg: interactiveShellArg,
31+
InteractiveShellExit: interactiveShellExit,
1932
OpenCommand: "open {{filename}}",
2033
OpenLinkCommand: "open {{link}}",
2134
}

0 commit comments

Comments
 (0)