Skip to content

Commit

Permalink
Merge pull request #85 from timholy/teh/no_display
Browse files Browse the repository at this point in the history
Don't launch ProfileGtk if there is no display available
  • Loading branch information
timholy authored Aug 22, 2017
2 parents 6fdc8eb + 7b5f2dc commit 6052b42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ os:
- linux
julia:
- 0.5
- 0.6
- nightly
notifications:
email: false
Expand Down
8 changes: 7 additions & 1 deletion src/ProfileView.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ const colors = distinguishable_colors(13, [bkg,fontcolor,gccolor],
cchoices=Float64[0, 50, 60, 70],
hchoices=linspace(0, 330, 24))[4:end]

function have_display()
!is_unix() && return true
is_apple() && return true
return haskey(ENV, "DISPLAY")
end

function __init__()
push!(LOAD_PATH, splitdir(@__FILE__)[1])
if isdefined(Main, :IJulia) && !isdefined(Main, :PROFILEVIEW_USEGTK)
if (isdefined(Main, :IJulia) && !isdefined(Main, :PROFILEVIEW_USEGTK)) || !have_display()
eval(Expr(:import, :ProfileViewSVG))
@eval begin
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)
Expand Down

0 comments on commit 6052b42

Please sign in to comment.