-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
make tempname
on windows match unix behavior
#25530
Conversation
base/file.jl
Outdated
@@ -344,6 +358,9 @@ tempdir() | |||
tempname() | |||
|
|||
Generate a unique temporary file path. | |||
Warning: this can lead to race conditions if another process obtains the same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make this a Documenter-style warning:
!!! warning
This can lead to race conditions if another process obtains the same
file name and creates the file before you are able to.
Using [`mktemp()`](@ref) is recommended instead.
+1, I like this approach. I was looking into this the other day and I found that in a lot of cases |
da609e2
to
e551cec
Compare
base/file.jl
Outdated
@@ -344,6 +358,12 @@ tempdir() | |||
tempname() | |||
|
|||
Generate a unique temporary file path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be good to specify here that the file is not created.
0209dc7
to
50d8320
Compare
50d8320
to
b323c31
Compare
tempname
on windows match unix behaviortempname
on windows match unix behavior
Nice to see another 4-digit issue resolved. 🙂 |
Here is a possible fix to #9053. From re-reading the thread I decided the following:
tempname
is not recommended, it has uses and it would be annoying for us to remove it.So this PR does the following:
tempname
on windows not to create the file, like unix. According to the docs it is possible to callGetTempFileNameW
such that it doesn't create the file.tempname(::UInt32)
because it's just weird.tempname
in Pkg tomktemp