Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compat for mktemp and mktempdir docstrings #38452

Merged
merged 2 commits into from
Nov 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions base/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,11 @@ tempname()
Return `(path, io)`, where `path` is the path of a new temporary file in `parent`
and `io` is an open file object for this path. The `cleanup` option controls whether
the temporary file is automatically deleted when the process exits.

!!! compat "Julia 1.3"
The `cleanup` keyword argument was added in Julia 1.3. Relatedly, starting from 1.3,
Julia will remove the temporary paths created by `mktemp` when the Julia process exits,
unless `cleanup` is explicitly set to `false`.
"""
mktemp(parent)

Expand All @@ -649,6 +654,14 @@ constructed from the given prefix and a random suffix, and return its path.
Additionally, any trailing `X` characters may be replaced with random characters.
If `parent` does not exist, throw an error. The `cleanup` option controls whether
the temporary directory is automatically deleted when the process exits.

!!! compat "Julia 1.2"
The `prefix` keyword argument was added in Julia 1.2.

!!! compat "Julia 1.3"
The `cleanup` keyword argument was added in Julia 1.3. Relatedly, starting from 1.3,
Julia will remove the temporary paths created by `mktempdir` when the Julia process
exits, unless `cleanup` is explicitly set to `false`.
"""
function mktempdir(parent::AbstractString=tempdir();
prefix::AbstractString=temp_prefix, cleanup::Bool=true)
Expand Down Expand Up @@ -705,6 +718,9 @@ end

Apply the function `f` to the result of [`mktempdir(parent; prefix)`](@ref) and remove the
temporary directory all of its contents upon completion.

!!! compat "Julia 1.2"
The `prefix` keyword argument was added in Julia 1.2.
"""
function mktempdir(fn::Function, parent::AbstractString=tempdir();
prefix::AbstractString=temp_prefix)
Expand Down