Overview
Context
Changes
Added call-with-environment-variables/call-with-environment-variables-core.scm version [0cbbe3445a].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
(define (call-with-environment-variables variables thunk)
@("Sets up environment variable via dynamic-wind which are taken down after thunk."
(variables "An alist of the form {{'((\"var\" . \"value\") ...)}}")
(thunk "The thunk to execute with a modified environment"))
(let ((pre-existing-variables
(map (lambda (var-value)
(let ((var (car var-value)))
(cons var (get-environment-variable var))))
variables)))
(dynamic-wind
(lambda () (void))
(lambda ()
(use posix)
(for-each (lambda (var-value)
(setenv (car var-value) (cdr var-value)))
variables)
(thunk))
(lambda ()
(for-each (lambda (var-value)
(let ((var (car var-value))
(value (cdr var-value)))
(if value
(setenv var value)
(unsetenv var))))
pre-existing-variables)))))
|
| | | | | | | | | | | | | | | | | | | | | | | |
Added call-with-environment-variables/call-with-environment-variables.meta version [827824779b].
|
1
2
3
4
5
6
7
8
9
10
11
|
+
+
+
+
+
+
+
+
+
+
+
|
((synopsis "Set up and take down environment vars")
(author "Peter Danenberg")
(email "pcd@roxygen.org")
(user "klutometis")
(repo "https://github.com/klutometis/call-with-environment-variables")
(category os)
(license "BSD")
(depends (hahn "0.9.3")
setup-helper)
(test-depends test)
(foreign-depends))
|
| | | | | | | | | |
Added call-with-environment-variables/call-with-environment-variables.release-info version [a5138452ec].
|
1
2
3
4
5
6
7
8
9
10
|
+
+
+
+
+
+
+
+
+
+
|
(repo git "git://github.com/klutometis/{egg-name}.git")
(uri targz "https://github.com/klutometis/{egg-name}/tarball/{egg-release}")
(release "0.1")
(release "0.1.1")
(release "0.1.2")
(release "0.1.3")
(release "0.1.4")
(release "0.1.5")
(release "0.1.6")
(release "0.1.7")
|
| | | | | | | | |
Added call-with-environment-variables/call-with-environment-variables.scm version [e786217131].
|
1
2
3
4
5
6
7
|
+
+
+
+
+
+
+
|
(module
call-with-environment-variables
(call-with-environment-variables)
(import scheme chicken)
(include "call-with-environment-variables-core.scm"))
|
| | | | | |
Added call-with-environment-variables/call-with-environment-variables.setup version [aa68521cc2].
|
1
2
3
4
5
6
7
8
9
10
|
+
+
+
+
+
+
+
+
+
+
|
(use hahn setup-helper-mod)
(verify-extension-name "call-with-environment-variables")
(setup-shared-extension-module
'call-with-environment-variables
(extension-version "0.1.6")
compile-options: '(-X hahn))
(run-hahn -o call-with-environment-variables.wiki call-with-environment-variables-core.scm)
|
| | | | | | | | |
Added call-with-environment-variables/call-with-environment-variables.wiki version [c4f0264957].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
== call-with-environment-variables
Set up and take down environment vars
[[toc:]]
=== {{call-with-environment-variables}}
<procedure>(call-with-environment-variables variables thunk) → unspecified</procedure>
Sets up environment variable via dynamic-wind which are taken down after thunk.
; {{variables}} : An alist of the form {{'(("var" . "value") ...)}}
; {{thunk}} : The thunk to execute with a modified environment
<enscript highlight="scheme">(define (call-with-environment-variables variables thunk)
(let ((pre-existing-variables
(map (lambda (var-value)
(let ((var (car var-value)))
(cons var (get-environment-variable var))))
variables)))
(dynamic-wind
(lambda () (void))
(lambda ()
(use posix)
(for-each
(lambda (var-value) (setenv (car var-value) (cdr var-value)))
variables)
(thunk))
(lambda ()
(for-each
(lambda (var-value)
(let ((var (car var-value)) (value (cdr var-value)))
(if value (setenv var value) (unsetenv var))))
pre-existing-variables)))))
</enscript>
=== About this egg
==== Author
[[/users/klutometis|Peter Danenberg]]
==== Repository
[[https://github.com/klutometis/call-with-environment-variables]]
==== License
BSD
==== Dependencies
* [[(hahn 0.9.3)]]
* [[setup-helper]]
==== Versions
; [[https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1|0.1]] : Initial release
; [[https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.1|0.1.1]] : Add the actual code.
; [[https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.2|0.1.2]] : Fix versions.
; [[https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.3|0.1.3]] : Update docs.
; [[https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.4|0.1.4]] : With a note about cock-utils
; [[https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.5|0.1.5]] : Docs
; [[https://github.com/klutometis/call-with-environment-variables/releases/tag/0.1.6|0.1.6]] : Use hahn.
==== Colophon
Documented by [[/egg/hahn|hahn]].
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |