diff --git a/CHANGELOG.md b/CHANGELOG.md index b80e98b5f3b..9d47fb993d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased - `LogTicks` now work well with `pseudolog10` [#5135](https://github.com/MakieOrg/Makie.jl/pull/5135) +- Fix `display(figurelike)` causing the REPL to hang when using CairoMakie on a Linux system [#5281](https://github.com/MakieOrg/Makie.jl/pull/5281) ## [0.24.6] - 2025-08-19 diff --git a/CairoMakie/src/display.jl b/CairoMakie/src/display.jl index 0bdb3e05ccb..584f62f1832 100644 --- a/CairoMakie/src/display.jl +++ b/CairoMakie/src/display.jl @@ -7,11 +7,26 @@ Try to run a command. Return `true` if `cmd` runs and is successful (exits with a code of `0`). Return `false` otherwise. """ -function tryrun(cmd::Cmd) - try - return success(cmd) - catch e - return false +function tryrun(cmd::Cmd; wait = true) + if wait + try + return success(cmd) + catch e + return false + end + else + proc = try + run(cmd; wait = false) + catch e + return false + end + sleep(1e-3) + if proc.exitcode == typemin(Int) || proc.exitcode == 0 + # still running || ran successfully + return true + else + return false + end end end @@ -21,8 +36,8 @@ function openurl(url::String) elseif Sys.iswindows() tryrun(`powershell.exe start $url`) && return elseif Sys.isunix() - tryrun(`xdg-open $url`) && return - tryrun(`gnome-open $url`) && return + tryrun(`xdg-open $url`; wait = false) && return + tryrun(`gnome-open $url`; wait = false) && return end tryrun(`python -mwebbrowser $(url)`) && return # our last hope