diff --git a/pkg/commands/oscommands/cmd_obj_builder.go b/pkg/commands/oscommands/cmd_obj_builder.go index 3e89ce102..c96f2c5bf 100644 --- a/pkg/commands/oscommands/cmd_obj_builder.go +++ b/pkg/commands/oscommands/cmd_obj_builder.go @@ -52,7 +52,7 @@ func (self *CmdObjBuilder) NewShell(commandStr string) ICmdObj { } func (self *CmdObjBuilder) NewInteractiveShell(commandStr string) ICmdObj { - quotedCommand := self.quotedCommandString(commandStr) + 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) diff --git a/pkg/commands/oscommands/dummies.go b/pkg/commands/oscommands/dummies.go index ab528782f..1e0150238 100644 --- a/pkg/commands/oscommands/dummies.go +++ b/pkg/commands/oscommands/dummies.go @@ -51,13 +51,14 @@ func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { } var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - InteractiveShell: "bash", - ShellArg: "-c", - InteractiveShellArg: "-i", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", + OS: "darwin", + Shell: "bash", + InteractiveShell: "bash", + ShellArg: "-c", + InteractiveShellArg: "-i", + InteractiveShellExit: "; exit $?", + 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 cbeb99d43..8da5572dc 100644 --- a/pkg/commands/oscommands/os.go +++ b/pkg/commands/oscommands/os.go @@ -35,13 +35,14 @@ type OSCommand struct { // Platform stores the os state type Platform struct { - OS string - Shell string - InteractiveShell string - ShellArg string - InteractiveShellArg string - OpenCommand string - OpenLinkCommand string + OS string + Shell string + InteractiveShell string + ShellArg string + InteractiveShellArg string + InteractiveShellExit 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 196e4d9f6..f5ea96900 100644 --- a/pkg/commands/oscommands/os_default_platform.go +++ b/pkg/commands/oscommands/os_default_platform.go @@ -10,13 +10,14 @@ import ( func GetPlatform() *Platform { return &Platform{ - OS: runtime.GOOS, - Shell: "bash", - InteractiveShell: getUserShell(), - ShellArg: "-c", - InteractiveShellArg: "-i", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", + OS: runtime.GOOS, + Shell: "bash", + InteractiveShell: getUserShell(), + ShellArg: "-c", + InteractiveShellArg: "-i", + InteractiveShellExit: "; exit $?", + OpenCommand: "open {{filename}}", + OpenLinkCommand: "open {{link}}", } } diff --git a/pkg/commands/oscommands/os_windows.go b/pkg/commands/oscommands/os_windows.go index 32cd59edb..a2088a407 100644 --- a/pkg/commands/oscommands/os_windows.go +++ b/pkg/commands/oscommands/os_windows.go @@ -2,10 +2,11 @@ package oscommands func GetPlatform() *Platform { return &Platform{ - OS: "windows", - Shell: "cmd", - InteractiveShell: "cmd", - ShellArg: "/c", - InteractiveShellArg: "", + OS: "windows", + Shell: "cmd", + InteractiveShell: "cmd", + ShellArg: "/c", + InteractiveShellArg: "", + InteractiveShellExit: "", } }