瀏覽代碼

Fixes: https://github.com/coreos/go-iptables/issues/35

Mark Sanborn 8 年之前
父節點
當前提交
6ec148c4de
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      iptables/iptables.go

+ 6 - 1
iptables/iptables.go

@@ -322,7 +322,12 @@ func (ipt *IPTables) runWithOutput(args []string, stdout io.Writer) error {
 	}
 
 	if err := cmd.Run(); err != nil {
-		return &Error{*(err.(*exec.ExitError)), cmd, stderr.String()}
+		switch e := err.(type) {
+		case *exec.ExitError:
+			return &Error{*e, stderr.String()}
+		default:
+			return err
+		}
 	}
 
 	return nil