From 13bf4d4a3e9f55c3b19d93a9c85ed8ce51f85d84 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 17 Mar 2021 13:52:17 +0100 Subject: [PATCH] return dnsmasq errors While debugging the rootless cni PR in podman I had a problem with the dnsname plugin because dnsmasq failed to start. The returned error was just `exit status 5`. This is not helpful. To solve this use CombinedOutput and wrap the dnsmasq output to the returned error. Signed-off-by: Paul Holzinger --- plugins/meta/dnsname/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/meta/dnsname/service.go b/plugins/meta/dnsname/service.go index 717d6c0..fc05f75 100644 --- a/plugins/meta/dnsname/service.go +++ b/plugins/meta/dnsname/service.go @@ -66,7 +66,10 @@ func (d dnsNameFile) start() error { fmt.Sprintf("--conf-file=%s", d.ConfigFile), } cmd := exec.Command(d.Binary, args...) - return cmd.Run() + if b, err := cmd.CombinedOutput(); err != nil { + return errors.Wrapf(err, "dnsname error: dnsmasq failed with %q", b) + } + return nil } // stop stops the dnsmasq instance.