MCPcopy Create free account
hub / github.com/buke/quickjs-go / js_std_getenv

Function js_std_getenv

deps/quickjs/quickjs-libc.c:972–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

970}
971
972static JSValue js_std_getenv(JSContext *ctx, JSValueConst this_val,
973 int argc, JSValueConst *argv)
974{
975 const char *name, *str;
976 name = JS_ToCString(ctx, argv[0]);
977 if (!name)
978 return JS_EXCEPTION;
979 str = getenv(name);
980 JS_FreeCString(ctx, name);
981 if (!str)
982 return JS_UNDEFINED;
983 else
984 return JS_NewString(ctx, str);
985}
986
987#if defined(_WIN32)
988static void setenv(const char *name, const char *value, int overwrite)

Callers

nothing calls this directly

Calls 2

JS_ToCStringFunction · 0.85
JS_NewStringFunction · 0.85

Tested by

no test coverage detected