Closed sanbornm closed 7 years ago
2017/04/13 22:29:33 fork/exec /usr/sbin/iptables: cannot allocate memory panic: interface conversion: error is *os.PathError, not *exec.ExitError
My Fix:
if err := cmd.Run(); err != nil { switch err.(type) { default: return err case *exec.ExitError: return &Error{*(err.(*exec.ExitError)), stderr.String()} } }
Thanks for reporting! Yes I think that the unchecked typecast in runWithOutput() is a bit too aggressive and your typeswitch-with-default fixes it. Would you mind turning this inline snippet into a PR?
runWithOutput()
My Fix: