File tree Expand file tree Collapse file tree 5 files changed +49
-6
lines changed
Expand file tree Collapse file tree 5 files changed +49
-6
lines changed Original file line number Diff line number Diff line change 3636 strategy :
3737 matrix :
3838 go-version :
39- - 1.23.7
39+ - 1.23.8
4040 sys :
4141 - {os: ubuntu-latest}
4242 - {os: macos-13, shell: zsh}
Original file line number Diff line number Diff line change 11module github.com/ActiveState/cli
22
3- go 1.23.7
3+ go 1.23.8
44
55require (
66 github.com/99designs/gqlgen v0.17.54
Original file line number Diff line number Diff line change @@ -251,18 +251,27 @@ func detectShellParent() string {
251251 multilog .Error ("Failed to get parent process: %s" , errs .JoinMessage (err ))
252252 }
253253
254+ shell := ""
254255 for p != nil && p .Pid != 0 {
255256 name , err := p .Name ()
256257 if err == nil {
257258 if strings .Contains (name , string (filepath .Separator )) {
258259 name = path .Base (name )
259260 }
260261 if supportedShellName (name ) {
261- return name
262+ if runtime .GOOS == "darwin" && name == bash .Name && shell == "" {
263+ // The installer starts State Tool after installing it. The user typically invokes the
264+ // installer using the one-line shell command. The one-liner tends to end up in bash,
265+ // which is often not the user's default on macOS. Try looking one level up for the
266+ // correct shell.
267+ shell = name
268+ } else {
269+ return name
270+ }
262271 }
263272 }
264273 p , _ = p .Parent ()
265274 }
266275
267- return ""
276+ return shell
268277}
Original file line number Diff line number Diff line change 1+ //go:build darwin
2+ // +build darwin
3+
4+ package subshell
5+
6+ import (
7+ "strings"
8+
9+ "github.com/ActiveState/cli/internal/subshell/bash"
10+ "github.com/ActiveState/cli/internal/subshell/fish"
11+ "github.com/ActiveState/cli/internal/subshell/tcsh"
12+ "github.com/ActiveState/cli/internal/subshell/zsh"
13+ )
14+
15+ var supportedShells = []SubShell {
16+ & bash.SubShell {},
17+ & zsh.SubShell {},
18+ & tcsh.SubShell {},
19+ & fish.SubShell {},
20+ }
21+
22+ const (
23+ SHELL_ENV_VAR = "SHELL"
24+ OS_DEFAULT = "zsh"
25+ )
26+
27+ func supportedShellName (filename string ) bool {
28+ for _ , subshell := range supportedShells {
29+ if strings .EqualFold (filename , subshell .Shell ()) {
30+ return true
31+ }
32+ }
33+ return false
34+ }
Original file line number Diff line number Diff line change 1- //go:build !windows
2- // +build !windows
1+ //go:build linux
2+ // +build linux
33
44package subshell
55
You can’t perform that action at this time.
0 commit comments