Skip to content

Commit

Permalink
move doc for withenv
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoegh committed Aug 13, 2016
1 parent 0531232 commit 023e416
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
11 changes: 0 additions & 11 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2127,17 +2127,6 @@ Largest integer less than or equal to `x/y`.
"""
fld

"""
withenv(f::Function, kv::Pair...)
Execute `f()` in an environment that is temporarily modified (not replaced as in `setenv`)
by zero or more `"var"=>val` arguments `kv`. `withenv` is generally used via the
`withenv(kv...) do ... end` syntax. A value of `nothing` can be used to temporarily unset an
environment variable (if it is set). When `withenv` returns, the original environment has
been restored.
"""
withenv

"""
setdiff!(s, iterable)
Expand Down
10 changes: 9 additions & 1 deletion base/env.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ function show(io::IO, ::EnvHash)
end
end

# temporarily set and then restore an environment value
"""
withenv(f::Function, kv::Pair...)
Execute `f()` in an environment that is temporarily modified (not replaced as in `setenv`)
by zero or more `"var"=>val` arguments `kv`. `withenv` is generally used via the
`withenv(kv...) do ... end` syntax. A value of `nothing` can be used to temporarily unset an
environment variable (if it is set). When `withenv` returns, the original environment has
been restored.
"""
function withenv{T<:AbstractString}(f::Function, keyvals::Pair{T}...)
old = Dict{T,Any}()
for (key,val) in keyvals
Expand Down

0 comments on commit 023e416

Please sign in to comment.