Start repl from non-interactive session

Basic example:

using Base: REPL, Terminals

term = Base.Terminals.TTYTerminal(get(ENV, "TERM", @static is_windows() ? "" : "dumb"), STDIN, STDOUT, STDERR)
active_repl = REPL.LineEditREPL(term, true)
REPL.run_repl(active_repl, backend->(global active_repl_backend = backend))

See _start in base/client.jl for how to set up history (and other options).

4 Likes