Skip to content

Commit

Permalink
Distinguish stdout and display contexts, see #2727
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwe authored and ReubenJ committed Aug 12, 2024
1 parent 91f182b commit c633fc9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/runner/PlutoRunner/src/PlutoRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1007,10 +1007,17 @@ const default_iocontext = IOContext(devnull,
:pluto_with_js_link => (io, callback, on_cancellation) -> core_with_js_link(io, callback, on_cancellation),
)

# `stdout` mimics a TTY, the only relevant property is :color
const default_stdout_iocontext = IOContext(devnull,
:color => true,
:limit => true,
:displaysize => (18, 75),
:color => true,
:is_pluto => false,
)

# `display` sees a richer context like in the REPL, see #2727
const default_display_iocontext = IOContext(devnull,
:color => true,
:limit => true,
:displaysize => (18, 75),
:is_pluto => false,
)

Expand Down Expand Up @@ -2826,7 +2833,7 @@ function with_io_to_logs(f::Function; enabled::Bool=true, loglevel::Logging.LogL
end

# To make the `display` function work.
redirect_display = TextDisplay(pe_stdout)
redirect_display = TextDisplay(IOContext(pe_stdout, default_display_iocontext))
pushdisplay(redirect_display)

# Run the function `f`, capturing all output that it might have generated.
Expand Down

0 comments on commit c633fc9

Please sign in to comment.