File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 66 "os"
77 "os/exec"
88 "os/signal"
9+ "path/filepath"
910 "syscall"
1011
1112 "github.com/creack/pty"
@@ -57,7 +58,14 @@ var shellCommand = &cli.Command{
5758 fmt .Printf (welcome , defaults .BinaryName ())
5859 shell := exec .Command (shpath )
5960 shell .Env = os .Environ ()
60- shell .Dir = defaults .EmbeddedClusterBinsSubDir ()
61+
62+ // get the current working directory
63+ var err error
64+ shell .Dir , err = os .Getwd ()
65+ if err != nil {
66+ return fmt .Errorf ("unable to get current working directory: %w" , err )
67+ }
68+
6169 shellpty , err := pty .Start (shell )
6270 if err != nil {
6371 return fmt .Errorf ("unable to start shell: %w" , err )
@@ -91,7 +99,7 @@ var shellCommand = &cli.Command{
9199
92100 // if /etc/bash_completion is present enable kubectl auto completion.
93101 if _ , err := os .Stat ("/etc/bash_completion" ); err == nil {
94- config = "source <(kubectl completion $(basename ${SHELL})) \n "
102+ config = fmt . Sprintf ( "source <(kubectl completion %s) \n " , filepath . Base ( shpath ))
95103 _ , _ = shellpty .WriteString (config )
96104 _ , _ = io .CopyN (io .Discard , shellpty , int64 (len (config )+ 1 ))
97105
You can’t perform that action at this time.
0 commit comments