diff --git a/pkg/commands/git_cmd_obj_builder.go b/pkg/commands/git_cmd_obj_builder.go index 7cb4f1496..21f300bb3 100644 --- a/pkg/commands/git_cmd_obj_builder.go +++ b/pkg/commands/git_cmd_obj_builder.go @@ -38,10 +38,6 @@ func (self *gitCmdObjBuilder) NewShell(cmdStr string) oscommands.ICmdObj { return self.innerBuilder.NewShell(cmdStr).AddEnvVars(defaultEnvVar) } -func (self *gitCmdObjBuilder) NewInteractiveShell(cmdStr string) oscommands.ICmdObj { - return self.innerBuilder.NewInteractiveShell(cmdStr).AddEnvVars(defaultEnvVar) -} - func (self *gitCmdObjBuilder) Quote(str string) string { return self.innerBuilder.Quote(str) } diff --git a/pkg/commands/oscommands/cmd_obj_builder.go b/pkg/commands/oscommands/cmd_obj_builder.go index c96f2c5bf..c72f3c187 100644 --- a/pkg/commands/oscommands/cmd_obj_builder.go +++ b/pkg/commands/oscommands/cmd_obj_builder.go @@ -14,8 +14,6 @@ type ICmdObjBuilder interface { New(args []string) ICmdObj // NewShell takes a string like `git commit` and returns an executable shell command for it e.g. `sh -c 'git commit'` NewShell(commandStr string) ICmdObj - // Like NewShell, but uses the user's shell rather than "bash", and passes -i to it - NewInteractiveShell(commandStr string) ICmdObj // Quote wraps a string in quotes with any necessary escaping applied. The reason for bundling this up with the other methods in this interface is that we basically always need to make use of this when creating new command objects. Quote(str string) string } @@ -51,13 +49,6 @@ func (self *CmdObjBuilder) NewShell(commandStr string) ICmdObj { return self.New(cmdArgs) } -func (self *CmdObjBuilder) NewInteractiveShell(commandStr string) ICmdObj { - quotedCommand := self.quotedCommandString(commandStr + self.platform.InteractiveShellExit) - cmdArgs := str.ToArgv(fmt.Sprintf("%s %s %s %s", self.platform.InteractiveShell, self.platform.InteractiveShellArg, self.platform.ShellArg, quotedCommand)) - - return self.New(cmdArgs) -} - func (self *CmdObjBuilder) quotedCommandString(commandStr string) string { // Windows does not seem to like quotes around the command if self.platform.OS == "windows" { diff --git a/pkg/commands/oscommands/dummies.go b/pkg/commands/oscommands/dummies.go index 1e0150238..3f72a6f06 100644 --- a/pkg/commands/oscommands/dummies.go +++ b/pkg/commands/oscommands/dummies.go @@ -51,14 +51,11 @@ func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { } var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - InteractiveShell: "bash", - ShellArg: "-c", - InteractiveShellArg: "-i", - InteractiveShellExit: "; exit $?", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", + OS: "darwin", + Shell: "bash", + ShellArg: "-c", + OpenCommand: "open {{filename}}", + OpenLinkCommand: "open {{link}}", } func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go index 8da5572dc..dc5ef222c 100644 --- a/pkg/commands/oscommands/os.go +++ b/pkg/commands/oscommands/os.go @@ -35,14 +35,11 @@ type OSCommand struct { // Platform stores the os state type Platform struct { - OS string - Shell string - InteractiveShell string - ShellArg string - InteractiveShellArg string - InteractiveShellExit string - OpenCommand string - OpenLinkCommand string + OS string + Shell string + ShellArg string + OpenCommand string + OpenLinkCommand string } // NewOSCommand os command runner diff --git a/pkg/commands/oscommands/os_default_platform.go b/pkg/commands/oscommands/os_default_platform.go index 065d7f297..fd4967d95 100644 --- a/pkg/commands/oscommands/os_default_platform.go +++ b/pkg/commands/oscommands/os_default_platform.go @@ -4,42 +4,15 @@ package oscommands import ( - "os" "runtime" - "strings" ) func GetPlatform() *Platform { - shell := getUserShell() - - interactiveShell := shell - interactiveShellArg := "-i" - interactiveShellExit := "; exit $?" - - if strings.HasSuffix(shell, "fish") { - interactiveShellExit = "; exit $status" - } else if !(strings.HasSuffix(shell, "bash") || strings.HasSuffix(shell, "zsh")) { - interactiveShell = "bash" - interactiveShellArg = "" - interactiveShellExit = "" - } - return &Platform{ - OS: runtime.GOOS, - Shell: "bash", - InteractiveShell: interactiveShell, - ShellArg: "-c", - InteractiveShellArg: interactiveShellArg, - InteractiveShellExit: interactiveShellExit, - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", + OS: runtime.GOOS, + Shell: "bash", + ShellArg: "-c", + OpenCommand: "open {{filename}}", + OpenLinkCommand: "open {{link}}", } } - -func getUserShell() string { - if shell := os.Getenv("SHELL"); shell != "" { - return shell - } - - return "bash" -} diff --git a/pkg/commands/oscommands/os_windows.go b/pkg/commands/oscommands/os_windows.go index a2088a407..783f50518 100644 --- a/pkg/commands/oscommands/os_windows.go +++ b/pkg/commands/oscommands/os_windows.go @@ -2,11 +2,8 @@ package oscommands func GetPlatform() *Platform { return &Platform{ - OS: "windows", - Shell: "cmd", - InteractiveShell: "cmd", - ShellArg: "/c", - InteractiveShellArg: "", - InteractiveShellExit: "", + OS: "windows", + Shell: "cmd", + ShellArg: "/c", } } diff --git a/pkg/gui/controllers/shell_command_action.go b/pkg/gui/controllers/shell_command_action.go index 01b6d1e36..547ab012d 100644 --- a/pkg/gui/controllers/shell_command_action.go +++ b/pkg/gui/controllers/shell_command_action.go @@ -31,7 +31,7 @@ func (self *ShellCommandAction) Call() error { self.c.LogAction(self.c.Tr.Actions.CustomCommand) return self.c.RunSubprocessAndRefresh( - self.c.OS().Cmd.NewInteractiveShell(command), + self.c.OS().Cmd.NewShell(command), ) }, HandleDeleteSuggestion: func(index int) error {