Commit 56b7eb7a authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Make setEnv accept empty strings.


 we cargo-culted
some incorrect code from base. Lift the restriction.
Signed-off-by: default avatarEdward Z. Yang <>
parent c2c5d36b
......@@ -51,9 +51,7 @@ lookupEnv name = (Just `fmap` System.getEnv name) `catchIO` const (return Nothin
-- Throws `Control.Exception.IOException` if either @name@ or @value@ is the
-- empty string or contains an equals sign.
setEnv :: String -> String -> IO ()
setEnv key value_
| null value = error "Distribution.Compat.setEnv: empty string"
| otherwise = setEnv_ key value
setEnv key value_ = setEnv_ key value
-- NOTE: Anything that follows NUL is ignored on both POSIX and Windows. We
-- still strip it manually so that the null check above succeeds if a value
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment