Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Show meaningful error message when kubectl exec fails #1966

Merged
merged 1 commit into from Feb 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/view/exec.go
Expand Up @@ -41,6 +41,10 @@ type shellOpts struct {

func runK(a *App, opts shellOpts) bool {
bin, err := exec.LookPath("kubectl")
if errors.Is(err, exec.ErrDot) {
log.Error().Err(err).Msgf("kubectl command must not be in the current working directory")
return false
}
if err != nil {
log.Error().Err(err).Msgf("kubectl command is not in your path")
return false
Expand Down Expand Up @@ -137,6 +141,10 @@ func execute(opts shellOpts) error {

func runKu(a *App, opts shellOpts) (string, error) {
bin, err := exec.LookPath("kubectl")
if errors.Is(err, exec.ErrDot) {
log.Error().Err(err).Msgf("kubectl command must not be in the current working directory")
return "", err
}
if err != nil {
log.Error().Err(err).Msgf("kubectl command is not in your path")
return "", err
Expand Down