From efcd6f91ba9a7dba42aa45088ef14ad7da695697 Mon Sep 17 00:00:00 2001 From: Lionel Zoubritzky Date: Tue, 11 Jul 2023 17:17:58 +0200 Subject: [PATCH 1/3] Fix precompilation of packages depending on PlotlyJS --- src/PlotlyJS.jl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/PlotlyJS.jl b/src/PlotlyJS.jl index 9d3e514e..38a662e8 100644 --- a/src/PlotlyJS.jl +++ b/src/PlotlyJS.jl @@ -95,7 +95,7 @@ function __init__() @warn("Warnings were generated during the last build of PlotlyJS: please check the build log at $_build_log") end - @async _start_kaleido_process() + kaleido_task = Base.Threads.@spawn _start_kaleido_process() if !isfile(_js_path) @info("plotly.js javascript libary not found -- downloading now") @@ -163,6 +163,19 @@ function __init__() dataset(::Type{DataFrames.DataFrame}, name::String) = DataFrames.DataFrame(dataset(CSV.File, name)) end end + + wait(kaleido_task) + + if ccall(:jl_generating_output, Cint, ()) == 1 + # ensure precompilation of packages depending on PlotlyJS finishes + if isdefined(P, :proc) + close(P.proc) + close(P.stdin) + close(P.stdout) + close(P.stderr) + sleep(0.1) # avoid a "waiting for IO to finish" warning + end + end end # for methods that update the layout, first apply to the plot, then let plotly.js From d13cf03c36c789ca1d353709b47cb09b9192e5f7 Mon Sep 17 00:00:00 2001 From: Lionel Zoubritzky Date: Tue, 11 Jul 2023 18:13:02 +0200 Subject: [PATCH 2/3] Properly close P.proc Co-authored-by: Jameson Nash --- src/PlotlyJS.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PlotlyJS.jl b/src/PlotlyJS.jl index 38a662e8..eab9c941 100644 --- a/src/PlotlyJS.jl +++ b/src/PlotlyJS.jl @@ -173,7 +173,7 @@ function __init__() close(P.stdin) close(P.stdout) close(P.stderr) - sleep(0.1) # avoid a "waiting for IO to finish" warning + wait(P.proc) end end end From f3896e59bf45335b3bdd9677ff31da2737079204 Mon Sep 17 00:00:00 2001 From: Lionel Zoubritzky Date: Tue, 11 Jul 2023 18:28:42 +0200 Subject: [PATCH 3/3] Keep change minimal Co-authored-by: Jameson Nash --- src/PlotlyJS.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/PlotlyJS.jl b/src/PlotlyJS.jl index eab9c941..6e25e6c9 100644 --- a/src/PlotlyJS.jl +++ b/src/PlotlyJS.jl @@ -169,10 +169,7 @@ function __init__() if ccall(:jl_generating_output, Cint, ()) == 1 # ensure precompilation of packages depending on PlotlyJS finishes if isdefined(P, :proc) - close(P.proc) close(P.stdin) - close(P.stdout) - close(P.stderr) wait(P.proc) end end