# HG changeset patch # User Adam Chlipala # Date 1393940793 18000 # Node ID 3d1d44111906d0da69384af9aa0faf69b451ee34 # Parent 7075acda4456216360b7107f915dd41880778c4a Change Basis.getenv to return None outside the context of a web request diff -r 7075acda4456 -r 3d1d44111906 src/c/urweb.c --- a/src/c/urweb.c Tue Feb 25 16:34:04 2014 -0500 +++ b/src/c/urweb.c Tue Mar 04 08:46:33 2014 -0500 @@ -3669,7 +3669,10 @@ } uw_Basis_string uw_Basis_getenv(uw_context ctx, uw_Basis_string name) { - return ctx->get_env(ctx->get_env_data, name); + if (ctx->get_env) + return ctx->get_env(ctx->get_env_data, name); + else + return NULL; } uw_Basis_string uw_unnull(uw_Basis_string s) { diff -r 7075acda4456 -r 3d1d44111906 tests/getenv.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/getenv.ur Tue Mar 04 08:46:33 2014 -0500 @@ -0,0 +1,3 @@ +task initialize = fn _ => + v <- getenv (blessEnvVar "USER"); + return {} diff -r 7075acda4456 -r 3d1d44111906 tests/getenv.urp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/getenv.urp Tue Mar 04 08:46:33 2014 -0500 @@ -0,0 +1,3 @@ +allow env USER + +getenv