RemoteREPL.jl icon indicating copy to clipboard operation
RemoteREPL.jl copied to clipboard

Feature Request: Ability to use Cthulhu within RemoteREPL

Open Ellipse0934 opened this issue 3 years ago • 1 comments

:sweat_smile:

Ellipse0934 avatar Jul 14 '21 21:07 Ellipse0934

To what extent is the Cthulhu.jl interface built around having direct access to stdout for display and stdin for user input? Looking at the code it seems this is somewhat assumed.

Seems there's two ways forward:

  • Generalize Cthulhu to allow stdout and stdin to be swapped in some way. Eg, make sure a REPL.Terminals.TTYTerminal is consistently passed around in a way we can override it (or should that be Base.TTY?). Perhaps make the TTY overridable with a task local variable. Cthulhu implicitly uses REPL.TerminalMenus.readkey to read keys from the user; eventually that needs to end up as a read to the client-side TTY.
  • Alternatively, invent a way for RemoteREPL to redirect and steal the global stdout and stdin of the server process. Certainly this is possible for stdout; for stdin I'm not sure how this could work. Presumably it'd need to involve a TTY.

The tricky part seems to be finding a way to detect that the server code is waiting on a read of the serverside TTY so that we can forward this read to the client. But without blocking the client TTY by trying to read from it when the server isn't waiting for input.

c42f avatar Jul 15 '21 01:07 c42f