Skip to content

Commit b76bc3d

Browse files
authored
fix interpreteing getting env vars on windows (#142)
1 parent 9fad884 commit b76bc3d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/JuliaInterpreter.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ function set_compiled_methods()
5959
push!(compiled_methods, which(reenable_sigint, Tuple{Function}))
6060
# Signal-handling in the `print` dispatch hierarchy
6161
push!(compiled_methods, which(Base.unsafe_write, Tuple{Base.LibuvStream, Ptr{UInt8}, UInt}))
62+
# Libc.GetLastError()
63+
@static if Sys.iswindows()
64+
push!(compiled_methods, which(Base.access_env, Tuple{Function, AbstractString}))
65+
push!(compiled_methods, which(Base._hasenv, Tuple{Vector{UInt16}}))
66+
end
6267
end
6368

6469
function __init__()

test/interpret.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,12 @@ end
385385
@test isa(JuliaInterpreter.prepare_call(varargidentity, [varargidentity, x])[1], JuliaInterpreter.FrameCode)
386386
end
387387

388+
# https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/141
389+
@test @interpret get(ENV, "THIS_IS_NOT_DEFINED_1234", "24") == "24"
390+
388391
# Test return value of whereis
389392
f() = nothing
390393
fr = JuliaInterpreter.enter_call(f)
391394
file, line = JuliaInterpreter.whereis(fr)
392395
@test file == @__FILE__
393-
@test line == (@__LINE__() - 4)
396+
@test line == (@__LINE__() - 4)

0 commit comments

Comments
 (0)