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

Function js_std_setenv

deps/quickjs/quickjs-libc.c:1009–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007#endif /* _WIN32 */
1008
1009static JSValue js_std_setenv(JSContext *ctx, JSValueConst this_val,
1010 int argc, JSValueConst *argv)
1011{
1012 const char *name, *value;
1013 name = JS_ToCString(ctx, argv[0]);
1014 if (!name)
1015 return JS_EXCEPTION;
1016 value = JS_ToCString(ctx, argv[1]);
1017 if (!value) {
1018 JS_FreeCString(ctx, name);
1019 return JS_EXCEPTION;
1020 }
1021 setenv(name, value, true);
1022 JS_FreeCString(ctx, name);
1023 JS_FreeCString(ctx, value);
1024 return JS_UNDEFINED;
1025}
1026
1027static JSValue js_std_unsetenv(JSContext *ctx, JSValueConst this_val,
1028 int argc, JSValueConst *argv)

Callers

nothing calls this directly

Calls 2

JS_ToCStringFunction · 0.85
setenvFunction · 0.85

Tested by

no test coverage detected