Avoid hard coding the bash path

OS distribution and user may choose to install bash in different path.
This patch uses bash found by "$PATH" environment, rather than hard code
the bash path.

This patch also handle the case 'bash' are not found. Mostly likely due
to bash not being supported by the platform, or it is not installed.
pull/66/head
Andy Zhou 5 years ago
parent 4ef6710e22
commit 5c6f2d7dc5
  1. 8
      cli/shell.go

@ -11,7 +11,13 @@ func bashShell(cluster string) error {
if err != nil {
return err
}
cmd := exec.Command("/bin/bash", "--noprofile", "--norc")
bashPath, err := exec.LookPath("bash")
if err != nil {
return err
}
cmd := exec.Command(bashPath, "--noprofile", "--norc")
// Set up stdio
cmd.Stdout = os.Stdout

Loading…
Cancel
Save