Removes an environment variable from the environment.
Note that on some systems, when variables are overwritten, the
memory used for the previous variables and its value isn't reclaimed.
You should be mindful of the fact that environment variable handling
in UNIX is not thread-safe, and your program may crash if one thread
calls g_unsetenv() while another thread is calling getenv(). (And note
that many functions, such as gettext(), call getenv() internally.) This
function is only safe to use at the very start of your program, before
creating any other threads (or creating objects that create worker
threads of their own).
If you need to set up the environment for a child process, you can
use g_get_environ() to get an environment array, modify that with
g_environ_setenv() and g_environ_unsetenv(), and then pass that
array directly to execvpe(), Spawn.async, or the like.
Removes an environment variable from the environment.
Note that on some systems, when variables are overwritten, the memory used for the previous variables and its value isn't reclaimed.
You should be mindful of the fact that environment variable handling in UNIX is not thread-safe, and your program may crash if one thread calls g_unsetenv() while another thread is calling getenv(). (And note that many functions, such as gettext(), call getenv() internally.) This function is only safe to use at the very start of your program, before creating any other threads (or creating objects that create worker threads of their own).
If you need to set up the environment for a child process, you can use g_get_environ() to get an environment array, modify that with g_environ_setenv() and g_environ_unsetenv(), and then pass that array directly to execvpe(), Spawn.async, or the like.