From 232d611210e6d5dcaf1805526eca9ef9d9e2da01 Mon Sep 17 00:00:00 2001 From: nhz2 Date: Thu, 17 Oct 2024 15:25:56 -0400 Subject: [PATCH 1/3] finalize memory if 1.11 --- src/file.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/file.jl b/src/file.jl index 5907ec9d..87997dda 100644 --- a/src/file.jl +++ b/src/file.jl @@ -336,8 +336,14 @@ function File(ctx::Context, @nospecialize(chunking::Bool=false)) ctx.debug && println("types after parsing: $types, pool = $(ctx.pool)") # for windows, it's particularly finicky about throwing errors when you try to modify an mmapped file # so we just want to make sure we finalize the input buffer so users don't run into surprises + # on Julia 1.11 the underlying memory needs to be finalized to unmmap the file. + # Ref: https://github.com/JuliaLang/julia/pull/54210 if !chunking && Sys.iswindows() && ctx.stringtype !== PosLenString - finalize(ctx.buf) + if VERSION ≥ v"1.11" + finalize(ctx.buf.ref.mem) + else + finalize(ctx.buf) + end end # check if a temp file was generated for parsing if !chunking && ctx.tempfile !== nothing && ctx.stringtype !== PosLenString From 85dd26d4837fd9867b3aa2ccefd703db21fc3ec8 Mon Sep 17 00:00:00 2001 From: nhz2 Date: Thu, 17 Oct 2024 19:13:37 -0400 Subject: [PATCH 2/3] don't download busybox in test --- test/basics.jl | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/test/basics.jl b/test/basics.jl index 8a4c5a64..24e913e1 100644 --- a/test/basics.jl +++ b/test/basics.jl @@ -378,21 +378,8 @@ f = CSV.File(IOBuffer("a,b,c\n1,2,3\n\n")) f = CSV.File(IOBuffer("zip\n11111-1111\n"), dateformat = "y-m-dTH:M:S.s") @test (length(f), length(f.names)) == (1, 1) -# Supporting commands across multiple platforms cribbed from julia/test/spawn.jl -catcmd = `cat` -havebb = false -if Sys.iswindows() - busybox = download("https://frippery.org/files/busybox/busybox.exe", joinpath(tempdir(), "busybox.exe")) - havebb = try # use busybox-w32 on windows, if available - success(`$busybox`) - true - catch - false - end - if havebb - catcmd = `$busybox cat` - end -end +# `cat` isn't always available on Windows +catcmd = `$(Base.julia_cmd()) --eval "write(stdout, open(ARGS[1]))"` f = CSV.File(`$(catcmd) $(joinpath(dir, "test_basic.csv"))`) @test columntable(f) == columntable(CSV.File(joinpath(dir, "test_basic.csv"))) From c20c83bedea9bae989301beda72f7e37aa38b615 Mon Sep 17 00:00:00 2001 From: nhz2 Date: Thu, 17 Oct 2024 19:27:08 -0400 Subject: [PATCH 3/3] test windows on lts --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba3deece..8d3935d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,9 @@ jobs: - os: ubuntu-latest arch: x64 version: 'nightly' + - os: windows-latest + arch: x64 + version: 'lts' steps: - run: git config --global core.autocrlf false