From b32809eae235ae5675bb2f673aa9e3ff7ebdf75f Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Sat, 21 Jul 2018 21:32:57 -0400 Subject: [PATCH] monkeypatch ffi.cdef to avoid redefine errors --- build/busted | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build/busted b/build/busted index 4c5299de2..a24dd4cae 100755 --- a/build/busted +++ b/build/busted @@ -1,3 +1,16 @@ #!/usr/bin/env resty +local ffi = require("ffi") + +-- without this we get errors such as "attempt to redefine XXX" +local old_cdef = ffi.cdef +local exists = {} +ffi.cdef = function(def) + if exists[def] then + return + end + exists[def] = true + return old_cdef(def) +end + require "busted.runner"({ standalone = false })