Skip to content

Instantly share code, notes, and snippets.

@gszr
Created April 23, 2019 18:14
Show Gist options
  • Save gszr/dbfe4762340637e25b03725f47aaa758 to your computer and use it in GitHub Desktop.
Save gszr/dbfe4762340637e25b03725f47aaa758 to your computer and use it in GitHub Desktop.
setenv
diff --git a/spec/helpers.lua b/spec/helpers.lua
index 85e9589d6..061ac68d0 100644
--- a/spec/helpers.lua
+++ b/spec/helpers.lua
@@ -1415,4 +1415,11 @@ return {
ngx.ctx.workspaces = old_ws
return res
end,
+ setenv = function(env, value)
+ local ffi = require "ffi"
+ ffi.cdef[[
+ int setenv(const char *name, const char *value, int overwrite);
+ ]]
+ return ffi.C.setenv(env, value, 1) == 0
+ end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment