Skip to content

Commit

Permalink
Improve detection of the user's shell
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Oct 2, 2019
1 parent ecf0662 commit 1929a0f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
7 changes: 1 addition & 6 deletions cmd/cd_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@ func (c *Config) runCDCmd(fs vfs.FS, args []string) error {
return err
}

shell, err := shell.CurrentUserShell()
if err != nil {
return err
}

shell, _ := shell.CurrentUserShell()
if err := os.Chdir(c.SourceDir); err != nil {
return err
}

return c.exec(fs, []string{shell})
}
6 changes: 1 addition & 5 deletions cmd/cd_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func (c *Config) runCDCmd(fs vfs.FS, args []string) error {
return err
}

shell, err := shell.CurrentUserShell()
if err != nil {
return err
}

shell, _ := shell.CurrentUserShell()
return c.run(fs, c.SourceDir, shell)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/spf13/viper v1.4.0
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.3.0
github.com/twpayne/go-shell v0.0.2
github.com/twpayne/go-shell v0.0.3
github.com/twpayne/go-vfs v1.3.4
github.com/twpayne/go-vfsafero v1.0.0
github.com/twpayne/go-xdg/v3 v3.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/twpayne/go-acl v0.0.2 h1:kGrBVkNNLBuQicfgSCCanepMKWdk4+JSNynF+MapLOQ=
github.com/twpayne/go-acl v0.0.2/go.mod h1:lVOy2syxHw2MVrvUnQhkFUXlPFKuFm3gdNMnybTbMuA=
github.com/twpayne/go-shell v0.0.2 h1:sZH588mQpnR7422kS4bhqydn8JFb7HCnAcqaDNy98y0=
github.com/twpayne/go-shell v0.0.2/go.mod h1:H/gzux0DOH5jsjQSHXs6rs2Onxy+V4j6ycZTOulC0l8=
github.com/twpayne/go-shell v0.0.3 h1:Tzi3t9zCNudAAsxd9UrmhZhqWfp7pjFh/xlJ6M8HmrQ=
github.com/twpayne/go-shell v0.0.3/go.mod h1:H/gzux0DOH5jsjQSHXs6rs2Onxy+V4j6ycZTOulC0l8=
github.com/twpayne/go-vfs v1.0.1/go.mod h1:OIXA6zWkcn7Jk46XT7ceYqBMeIkfzJ8WOBhGJM0W4y8=
github.com/twpayne/go-vfs v1.0.5 h1:i45a6Ykg/asDB94fHH5OmScCQHFx/P9A//9M5dfXwQk=
github.com/twpayne/go-vfs v1.0.5/go.mod h1:OIXA6zWkcn7Jk46XT7ceYqBMeIkfzJ8WOBhGJM0W4y8=
Expand Down

0 comments on commit 1929a0f

Please sign in to comment.