Skip to content

Commit 7ce21ff

Browse files
wait killing the process (#14)
* wait for the kill * test windows * use old version because of windows * didn't help * bump version number
1 parent c7dc1f9 commit 7ce21ff

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

.github/workflows/tests.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ jobs:
1212
if: "!contains(github.event.head_commit.message, '[skip ci]')"
1313
runs-on: ${{ matrix.os }}
1414
strategy:
15+
fail-fast: false
1516
matrix:
1617
julia-version: ['1.6', '1']
1718
julia-arch: [x64]
18-
os: [ubuntu-latest, macOS-latest]
19+
os: [ubuntu-latest, macOS-latest, windows-latest]
1920

2021
steps:
2122
- uses: actions/checkout@v2

Project.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PlotlyKaleido"
22
uuid = "f2990250-8cf9-495f-b13a-cce12b45703c"
33
authors = ["Simon Christ <[email protected]>", "Spencer Lyon <[email protected]>"]
4-
version = "2.2.0"
4+
version = "2.2.1"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -11,6 +11,7 @@ Kaleido_jll = "f7e6163d-2fa5-5f23-b69c-1db539e41963"
1111
[compat]
1212
JSON = "0.21"
1313
julia = "1.6"
14+
Kaleido_jll = "0.1, 0.2"
1415

1516
[extras]
1617
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/PlotlyKaleido.jl

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ const P = Pipes()
2020
const _mathjax_url_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax"
2121
const _mathjax_last_version = v"2.7.9"
2222

23-
kill_kaleido() = is_running() && kill(P.proc)
23+
kill_kaleido() = is_running() && (kill(P.proc); wait(P.proc))
2424

2525
is_running() = isdefined(P, :proc) && isopen(P.stdin) && process_running(P.proc)
2626

27-
restart(;kwargs...) = (kill_kaleido(); sleep(0.1); start(;kwargs...))
27+
restart(;kwargs...) = (kill_kaleido(); start(;kwargs...))
2828

29-
function start(;plotly_version = missing,
30-
mathjax = missing, mathjax_version::VersionNumber = _mathjax_last_version,
29+
function start(;plotly_version = missing,
30+
mathjax = missing, mathjax_version::VersionNumber = _mathjax_last_version,
3131
kwargs...)
3232
is_running() && return
3333
cmd = joinpath(Kaleido_jll.artifact_dir, "kaleido" * (Sys.iswindows() ? ".cmd" : ""))
@@ -50,12 +50,12 @@ function start(;plotly_version = missing,
5050
end
5151
if mathjax isa Bool && mathjax
5252
push!(chromium_flags, "--mathjax=$(_mathjax_url_path)/$(mathjax_version)/MathJax.js")
53-
elseif mathjax isa String
53+
elseif mathjax isa String
5454
# We expect the keyword argument to be a valid URL or similar, else error "Kaleido startup failed with code 1".
5555
push!(chromium_flags, "--mathjax=$(mathjax)")
5656
else
57-
@warn """The value of the provided argument
58-
mathjax=$(mathjax)
57+
@warn """The value of the provided argument
58+
mathjax=$(mathjax)
5959
is neither a Bool nor a String and has been ignored."""
6060
end
6161
end

test/runtests.jl

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
using Test
22
@test_nowarn @eval using PlotlyKaleido
33

4-
PlotlyKaleido.start()
4+
@testset "Start" begin
5+
@test_nowarn PlotlyKaleido.start()
6+
@test PlotlyKaleido.is_running()
7+
end
8+
59

610
import PlotlyLight, EasyConfig, PlotlyJS
711

@@ -29,3 +33,9 @@ end
2933
end
3034
end
3135
end
36+
37+
@testset "Shutdown" begin
38+
PlotlyKaleido.kill_kaleido()
39+
@test !PlotlyKaleido.is_running()
40+
41+
end

0 commit comments

Comments
 (0)