I'm using RLWrap to "tame" a really good REPL, Dyalog APL, that unfortunately had its origins in Windows land and therefore does not comply with UNIX conventions. Moreover, being a closed source product, it cannot be modified to do so.
I managed to achieve most of my goals, but Ctrl-D still causes it to barf an error and keep running, while I would like it to cause a graceful exit, like any other REPL.
I looked into rlwrap options, as well as its filter API, for a way to intercept EOF coming from the user and translate it into a custom exit command, which would be )off
in my case, but I couldn't find a way to do it.
My current alias:
alias dyalog='rlwrap -a -H ~/.dyalog_history /opt/mdyalog/17.0/64/unicode/dyalog -b -s'
Relevant options are:
-s
tells Dyalog to start in a simple REPL mode, without taking control of the screen;-a
tells RLWrap to always remain in readline mode, ignoring Dyalog's attempts to read the input character by character.