Open
Description
Even on basic scenarios, a file on windows does not get released correctly by the process
data = open(file_name) do f
read(f, String)
end
After this, the Computer Management on Windows will show the file in the Open Files for a while.
This can help temporarily fixing the issue
function open(f, file)
io = open(file)
handle = Libc._get_osfhandle(RawFD(fd(io)))
try
return f(io)
finally
close(io)
ccall(:CloseHandle, stdcall, Cint, (Ptr{Cvoid},), handle)
end
end
julia> versioninfo()
Julia Version 1.6.4
Commit 35f0c91 (2021-11-19 03:54 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Xeon(R) Gold 6242 CPU @ 2.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake-avx512)