Skip to content

Commit 6052b42

Browse files
authored
Merge pull request #85 from timholy/teh/no_display
Don't launch ProfileGtk if there is no display available
2 parents 6fdc8eb + 7b5f2dc commit 6052b42

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ os:
33
- linux
44
julia:
55
- 0.5
6+
- 0.6
67
- nightly
78
notifications:
89
email: false

src/ProfileView.jl

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ const colors = distinguishable_colors(13, [bkg,fontcolor,gccolor],
3535
cchoices=Float64[0, 50, 60, 70],
3636
hchoices=linspace(0, 330, 24))[4:end]
3737

38+
function have_display()
39+
!is_unix() && return true
40+
is_apple() && return true
41+
return haskey(ENV, "DISPLAY")
42+
end
43+
3844
function __init__()
3945
push!(LOAD_PATH, splitdir(@__FILE__)[1])
40-
if isdefined(Main, :IJulia) && !isdefined(Main, :PROFILEVIEW_USEGTK)
46+
if (isdefined(Main, :IJulia) && !isdefined(Main, :PROFILEVIEW_USEGTK)) || !have_display()
4147
eval(Expr(:import, :ProfileViewSVG))
4248
@eval begin
4349
view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = []) = ProfileViewSVG.view(data; C=C, lidict=lidict, colorgc=colorgc, fontsize=fontsize, combine=combine, pruned=pruned)

0 commit comments

Comments
 (0)