((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/call-with-environment-variables" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.")) (section 2 "call-with-environment-variables" (p "Set up and take down environment vars") (toc) (section 3 (tt "call-with-environment-variables") (def (sig (procedure "(call-with-environment-variables variables thunk) → unspecified" (id call-with-environment-variables))) (p "Sets up environment variable via dynamic-wind which are taken down after thunk.") (dl (dt (tt "variables")) (dd "An alist of the form " (tt "'((\"var\" . \"value\") ...)")) (dt (tt "thunk")) (dd "The thunk to execute with a modified environment")) (highlight scheme "(define (call-with-environment-variables variables thunk)\n  (let ((pre-existing-variables\n          (map (lambda (var-value)\n                 (let ((var (car var-value)))\n                   (cons var (get-environment-variable var))))\n               variables)))\n    (dynamic-wind\n      (lambda () (void))\n      (lambda ()\n        (use posix)\n        (for-each\n          (lambda (var-value) (setenv (car var-value) (cdr var-value)))\n          variables)\n        (thunk))\n      (lambda ()\n        (for-each\n          (lambda (var-value)\n            (let ((var (car var-value)) (value (cdr var-value)))\n              (if value (setenv var value) (unsetenv var))))\n          pre-existing-variables)))))"))) (section 3 "About this egg" (section 4 "Author" (p (int-link "/users/klutometis" "Peter Danenberg"))) (section 4 "Repository" (p (link "https://github.com/klutometis/call-with-environment-variables"))) (section 4 "License" (p "BSD")) (section 4 "Dependencies" (ul (li (int-link "hahn")) (li (int-link "setup-helper")))) (section 4 "Versions" (dl (dt (link "https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1" "0.1")) (dd "Initial release") (dt (link "https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.1" "0.1.1")) (dd "Add the actual code.") (dt (link "https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.2" "0.1.2")) (dd "Fix versions.") (dt (link "https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.3" "0.1.3")) (dd "Update docs.") (dt (link "https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.4" "0.1.4")) (dd "With a note about cock-utils") (dt (link "https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.5" "0.1.5")) (dd "Docs") (dt (link "https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.6" "0.1.6")) (dd "Use hahn.") (dt (link "https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.7" "0.1.7")) (dd "Specify hahn-version."))) (section 4 "Colophon" (p "Documented by " (int-link "/egg/hahn" "hahn") ".")))))