Skip to content

Commit 00c0b26

Browse files
committed
Display the error when the plugin command failed to run
Which is different from running, and failing. One reason this can happen if the plugin is a shell script without a hash-bang line. Also removed a Debugf() call because there is no way to change the logging level when invoking a plugin. Signed-off-by: Jan Dubois <jan.dubois@suse.com>
1 parent d4f4911 commit 00c0b26

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)