]> gitweb.factorcode.org Git - factor.git/commitdiff
environment: Call unset-os-env when passed an ``f``. Fixes #794.
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 29 Mar 2013 18:38:37 +0000 (11:38 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 29 Mar 2013 18:39:11 +0000 (11:39 -0700)
basis/environment/environment-tests.factor
basis/environment/unix/unix.factor

index c84ddd8edd508dbdae164f952604fe2d5c144924..524cf89ccf3811b41e2875f70d99dab824540edd 100644 (file)
@@ -32,3 +32,6 @@ os unix? [
     "factor-test-key-change" os-env
 ] unit-test
 [ ] [ "factor-test-key-change" unset-os-env ] unit-test
+
+! Issue #794, setting something to ``f`` is a memory protection fault on mac
+[ ] [ f "dummy-env-variable-for-factor-test" set-os-env ] unit-test
index 94177913c1d000f06108479d3573b0390b7bdf1d..96ad3759c4db171009b8dedad3f249fba4a1ab80 100644 (file)
@@ -12,7 +12,12 @@ M: unix environ ( -- void* ) &: environ ;
 
 M: unix os-env ( key -- value ) getenv ;
 
-M: unix set-os-env ( value key -- ) swap 1 setenv io-error ;
+M: unix set-os-env ( value key -- )
+    over [
+        swap 1 setenv io-error
+    ] [
+        nip unset-os-env
+    ] if ;
 
 M: unix unset-os-env ( key -- ) unsetenv io-error ;