mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-08 22:36:49 +02:00
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.
This commit is contained in:
@ -6,16 +6,29 @@ package oscommands
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetPlatform() *Platform {
|
func GetPlatform() *Platform {
|
||||||
|
shell := getUserShell()
|
||||||
|
|
||||||
|
interactiveShell := shell
|
||||||
|
interactiveShellArg := "-i"
|
||||||
|
interactiveShellExit := "; exit $?"
|
||||||
|
|
||||||
|
if !(strings.HasSuffix(shell, "bash") || strings.HasSuffix(shell, "zsh")) {
|
||||||
|
interactiveShell = "bash"
|
||||||
|
interactiveShellArg = ""
|
||||||
|
interactiveShellExit = ""
|
||||||
|
}
|
||||||
|
|
||||||
return &Platform{
|
return &Platform{
|
||||||
OS: runtime.GOOS,
|
OS: runtime.GOOS,
|
||||||
Shell: "bash",
|
Shell: "bash",
|
||||||
InteractiveShell: getUserShell(),
|
InteractiveShell: interactiveShell,
|
||||||
ShellArg: "-c",
|
ShellArg: "-c",
|
||||||
InteractiveShellArg: "-i",
|
InteractiveShellArg: interactiveShellArg,
|
||||||
InteractiveShellExit: "; exit $?",
|
InteractiveShellExit: interactiveShellExit,
|
||||||
OpenCommand: "open {{filename}}",
|
OpenCommand: "open {{filename}}",
|
||||||
OpenLinkCommand: "open {{link}}",
|
OpenLinkCommand: "open {{link}}",
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user