Skip to content

Commit f366cdc

Browse files
Merge pull request #469 from Liozou/precompilationbackgroundtask
Fix precompilation of packages depending on PlotlyJS
2 parents 43d38e9 + f3896e5 commit f366cdc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/PlotlyJS.jl

+11-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function __init__()
9595
@warn("Warnings were generated during the last build of PlotlyJS: please check the build log at $_build_log")
9696
end
9797

98-
@async _start_kaleido_process()
98+
kaleido_task = Base.Threads.@spawn _start_kaleido_process()
9999

100100
if !isfile(_js_path)
101101
@info("plotly.js javascript libary not found -- downloading now")
@@ -163,6 +163,16 @@ function __init__()
163163
dataset(::Type{DataFrames.DataFrame}, name::String) = DataFrames.DataFrame(dataset(CSV.File, name))
164164
end
165165
end
166+
167+
wait(kaleido_task)
168+
169+
if ccall(:jl_generating_output, Cint, ()) == 1
170+
# ensure precompilation of packages depending on PlotlyJS finishes
171+
if isdefined(P, :proc)
172+
close(P.stdin)
173+
wait(P.proc)
174+
end
175+
end
166176
end
167177

168178
# for methods that update the layout, first apply to the plot, then let plotly.js

0 commit comments

Comments
 (0)