Skip to content

Commit 1596ab0

Browse files
authored
Define default terminal ourselves (#643)
1 parent 52bf170 commit 1596ab0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/CthulhuBase.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ function __descend_with_error_handling(args...; terminal=default_terminal(), kwa
142142
return nothing
143143
end
144144

145-
default_terminal() = REPL.LineEdit.terminal(Base.active_repl)
145+
function default_terminal()
146+
term_env = get(ENV, "TERM", @static Sys.iswindows() ? "" : "dumb")
147+
term = REPL.Terminals.TTYTerminal(term_env, stdin, stdout, stderr)
148+
return term
149+
end
146150

147151
descend_impl(@nospecialize(args...); kwargs...) =
148152
_descend_with_error_handling(args...; iswarn=true, kwargs...)

test/test_terminal.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ macro with_try_stderr(out, expr)
4040
end
4141

4242
@testset "Terminal" begin
43-
if isdefined(Base, :active_repl)
44-
@test Cthulhu.default_terminal() isa REPL.Terminals.TTYTerminal
45-
end
43+
@test Cthulhu.default_terminal() isa REPL.Terminals.TTYTerminal
4644
colorize(use_color::Bool, c::Char) = Cthulhu.stringify() do io
4745
use_color ? printstyled(io, c; color=:cyan) : print(io, c)
4846
end

0 commit comments

Comments
 (0)