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

Invalid call to sandbox in Julia 1.11-beta #86

Open
kbarros opened this issue Apr 16, 2024 · 3 comments
Open

Invalid call to sandbox in Julia 1.11-beta #86

kbarros opened this issue Apr 16, 2024 · 3 comments

Comments

@kbarros
Copy link
Contributor

kbarros commented Apr 16, 2024

I encountered the following error when trying to use TestItemRunner in combination with Julia 1.11-beta:

┌ Error: Some Julia code in the VS Code extension crashed
└ @ Main ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/error_handler.jl:15
ERROR: MethodError: no method matching sandbox(::VSCodeTestServer.TestEnv.var"#3#4"{VSCodeTestServer.var"#13#15"{Base.PipeEndpoint}}, ::Pkg.Types.Context, ::Pkg.Types.PackageSpec, ::String, ::String, ::Nothing; allow_reresolve::Bool)
The function `sandbox` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  sandbox(::Function, ::Pkg.Types.Context, ::Pkg.Types.PackageSpec, ::String, ::Any; preferences, force_latest_compatible_version, allow_earlier_backwards_compatible_versions, allow_reresolve)
   @ Pkg ~/.julia/juliaup/julia-1.11.0-beta1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Pkg/src/Operations.jl:1814

Stacktrace:
 [1] activate(f::VSCodeTestServer.var"#13#15"{Base.PipeEndpoint}, pkg::String; allow_reresolve::Bool)
   @ VSCodeTestServer.TestEnv ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/packages/TestEnv/src/julia-1.9/activate_do.jl:17
 [2] activate(f::Function, pkg::String)
   @ VSCodeTestServer.TestEnv ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/packages/TestEnv/src/julia-1.9/activate_do.jl:12
 [3] serve(conn::Base.PipeEndpoint, project_path::String, package_path::String, package_name::String; is_dev::Bool, crashreporting_pipename::Nothing)
   @ VSCodeTestServer ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/packages/VSCodeTestServer/src/VSCodeTestServer.jl:226
 [4] serve(conn::Base.PipeEndpoint, project_path::String, package_path::String, package_name::String)
   @ VSCodeTestServer ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/packages/VSCodeTestServer/src/VSCodeTestServer.jl:219
 [5] top-level scope
   @ ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/testserver/testserver_main.jl:17
 [6] include(mod::Module, _path::String)
   @ Base ./Base.jl:558
 [7] exec_options(opts::Base.JLOptions)
   @ Base ./client.jl:318
 [8] _start()
   @ Base ./client.jl:526
@oxinabox
Copy link
Member

it would be useful to have a MWE for this that can be run just in the REPL.

@kbarros
Copy link
Contributor Author

kbarros commented Apr 17, 2024

I can reproduce this with the following:

using TestEnv

pkg = "Sunny" # Replace this with something in your environment
TestEnv.activate(pkg) do
    ()
end

Reduced from the original code: https://github.com/julia-vscode/julia-vscode/blob/9b009459727161f9292d2890d6c5433ec6932960/scripts/packages/VSCodeTestServer/src/VSCodeTestServer.jl#L226-L228

Thanks!

@kbarros
Copy link
Contributor Author

kbarros commented Apr 22, 2024

The new sandbox seems to longer require the path argument. I guess this line:

return sandbox(ctx, pkgspec, path, joinpath(path, "test"), test_project_override) do
flush(stdout)
f()
end

Could be modified (for Julia 1.11) to become:

return sandbox(ctx, pkgspec, joinpath(path, "test"), test_project_override) do 
     flush(stdout) 
     f() 
 end 

As a reference, see how sandbox is being called inside Pkg.jl:
https://github.com/JuliaLang/Pkg.jl/blob/00aa38cb3a85e200c4bd19efef3a15e32e192a8f/src/Operations.jl#L2154-L2155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants