Skip to content

Commit

Permalink
Ensure that errors due to env instantiation are printed
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHatherly committed Nov 26, 2024
1 parent c02c2d3 commit 74643fc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/worker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ function worker_init(f::File, options::Dict)

push!(LOAD_PATH, $(project))

# When a manifest already exists ensure the environment is able to
# be precompiled with the version of Julia that is using it. If we
# just proceed to import `QuartoNotebookWorker` directly then these
# potential errors are not passed back to the server process, thus
# hiding the issues.
let
_isfile(::Any) = false
_isfile(s::AbstractString) = Base.isfile(s)
project = Base.active_project()
if _isfile(project)
manifest = Base.project_file_manifest_path(project)
if _isfile(manifest)
pushfirst!(LOAD_PATH, "@stdlib")
import Pkg
popfirst!(LOAD_PATH)
Pkg.precompile(; strict = true) # Throws an error when it fails.
end
end
end

let QNW = task_local_storage(:QUARTO_NOTEBOOK_WORKER_OPTIONS, $(options)) do
Base.require(
Base.PkgId(
Expand Down

0 comments on commit 74643fc

Please sign in to comment.