Skip to content

Commit d3cdad6

Browse files
johnnychen94jwortmannbarucden
committed
let is_sixel_supported a non-throw function
Co-Authored-By: jwortmann <[email protected]> Co-Authored-By: Denis Baručić <[email protected]>
1 parent 6060ffd commit d3cdad6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Sixel.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ Check if given terminal `tty` supports sixel format.
4646
(Experiment) The return value is not fully tested on all terminals and all platforms.
4747
"""
4848
function is_sixel_supported(tty::Base.TTY=stdout)
49-
device_attributes = TerminalTools.query_terminal("\033[0c", tty)
50-
"4" in split(chop(device_attributes), ';')
49+
try
50+
device_attributes = TerminalTools.query_terminal("\033[0c", tty)
51+
"4" in split(chop(device_attributes), ';')
52+
catch
53+
return false
54+
end
5155
end
5256
is_sixel_supported(io::IO) = false
5357

src/terminaltools.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ function query_terminal(msg, tty::TTY; timeout=1)
6767
end
6868
catch e
6969
e isa TimeoutException && return ""
70+
rethrow()
7071
end
7172
end
7273
function query_terminal(msg, regex, tty::TTY; kwargs...)

0 commit comments

Comments
 (0)