Skip to content

Commit d3fe5f8

Browse files
authored
Merge pull request #20794 from JuliaLang/jb/replIO
allow TTYTerminal output streams to be non-TTYs
2 parents daefda4 + 3a4cc44 commit d3fe5f8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

base/Terminals.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ end
100100

101101
mutable struct TTYTerminal <: UnixTerminal
102102
term_type::String
103-
in_stream::Base.TTY
104-
out_stream::Base.TTY
105-
err_stream::Base.TTY
103+
in_stream::IO
104+
out_stream::IO
105+
err_stream::IO
106106
end
107107

108108
const CSI = "\x1b["

test/repl.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,3 +632,10 @@ let ends_with_semicolon = Base.REPL.ends_with_semicolon
632632
@test !ends_with_semicolon("begin\na; #=#=#\n=#b=#\nend")
633633
@test ends_with_semicolon("\na; #=#=#\n=#b=#\n# test\n#=\nfoobar\n=##bazbax\n")
634634
end
635+
636+
# PR #20794, TTYTerminal with other kinds of streams
637+
let term = Base.Terminals.TTYTerminal("dumb",IOBuffer("1+2\n"),IOBuffer(),IOBuffer())
638+
r = Base.REPL.BasicREPL(term)
639+
REPL.run_repl(r)
640+
@test String(take!(term.out_stream)) == "julia> 3\n\njulia> \n"
641+
end

0 commit comments

Comments
 (0)