setenv-0.1.1.3: A cross-platform library for setting environment variables
Safe HaskellSafe-Inferred
LanguageHaskell98

System.SetEnv

Synopsis

Documentation

setEnv :: String -> String -> IO () #

setEnv name value sets the specified environment variable to value.

Early versions of this function operated under the mistaken belief that setting an environment variable to the empty string on Windows removes that environment variable from the environment. For the sake of compatibility, it adopted that behavior on POSIX. In particular

setEnv name ""

has the same effect as

unsetEnv name

If you'd like to be able to set environment variables to blank strings, use setEnv.

Throws IOException if name is the empty string or contains an equals sign.

Beware that this function must not be executed concurrently with getEnv, lookupEnv, getEnvironment and such. One thread reading environment variables at the same time with another one modifying them can result in a segfault, see Setenv is not Thread Safe for discussion.

@since base-4.7.0.0

unsetEnv :: String -> IO () #

unsetEnv name removes the specified environment variable from the environment of the current process.

Throws IOException if name is the empty string or contains an equals sign.

Beware that this function must not be executed concurrently with getEnv, lookupEnv, getEnvironment and such. One thread reading environment variables at the same time with another one modifying them can result in a segfault, see Setenv is not Thread Safe for discussion.

@since base-4.7.0.0