From 5348b5e69666bbad85395eec5bff40a8aefd1f76 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Fri, 28 Apr 2023 08:35:18 +0000 Subject: [PATCH] Improve error message when CLI wrapper Exec fails Signed-off-by: Brad Davidson --- cmd/k3s/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/k3s/main.go b/cmd/k3s/main.go index edce8215d615..def64bc9a3ee 100644 --- a/cmd/k3s/main.go +++ b/cmd/k3s/main.go @@ -204,7 +204,10 @@ func stageAndRun(dataDir, cmd string, args []string) error { logrus.Debugf("Running %s %v", cmd, args) - return syscall.Exec(cmd, args, os.Environ()) + if err := syscall.Exec(cmd, args, os.Environ()); err != nil { + return errors.Wrapf(err, "exec %s failed", cmd) + } + return nil } // getAssetAndDir returns the name of the bindata asset, along with a directory path