Skip to content

Commit 4f05d92

Browse files
authored
Merge pull request #3902 from jandubois/plugin-err
Display the error when the plugin command failed to run
2 parents 319a052 + 00c0b26 commit 4f05d92

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmd/limactl/main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,18 @@ func runExternalPlugin(ctx context.Context, name string, args []string) {
242242
return
243243
}
244244

245-
logrus.Debugf("found external command: %s", execPath)
246-
247245
cmd := exec.CommandContext(ctx, execPath, args...)
248246
cmd.Stdin = os.Stdin
249247
cmd.Stdout = os.Stdout
250248
cmd.Stderr = os.Stderr
251249
cmd.Env = os.Environ()
252250

253-
handleExitCoder(cmd.Run())
254-
os.Exit(0) //nolint:revive // it's intentional to call os.Exit in this function
251+
err = cmd.Run()
252+
handleExitCoder(err)
253+
if err == nil {
254+
os.Exit(0) //nolint:revive // it's intentional to call os.Exit in this function
255+
}
256+
logrus.Fatalf("external command %q failed: %v", execPath, err)
255257
}
256258

257259
func updatePathEnv() error {

0 commit comments

Comments
 (0)