From 904d5f5fb661d872f24bbd390afe99cb41149bc3 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Fri, 23 Aug 2024 07:48:38 +0800 Subject: [PATCH] setenv/unsetenv --- spec/details/misc.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/details/misc.lua b/spec/details/misc.lua index 459192379c..1ec4bd9dc3 100644 --- a/spec/details/misc.lua +++ b/spec/details/misc.lua @@ -120,6 +120,8 @@ end -- @param value the value to set -- @return true on success, false otherwise local function setenv(env, value) + assert(type(env) == "string", "env must be a string") + assert(type(value) == "string", "value must be a string") return ffi.C.setenv(env, value, 1) == 0 end @@ -129,6 +131,7 @@ end -- @param env (string) name of the environment variable -- @return true on success, false otherwise local function unsetenv(env) + assert(type(env) == "string", "env must be a string") return ffi.C.unsetenv(env) == 0 end