risor-io/risor

REPL should error if no tty

Closed this issue · 0 comments

Example:

risor > file.txt

This blocks until I press Ctrl+D. The content of file.txt is then also this:

Risor

>>> ^M>>> o^M>>> oh^M>>> oh ^M>>> oh n^M>>> oh no^M>>> oh no ^M>>> oh no i^M>>> oh no im^M>>> oh no im ^M>>> oh no im s^M>>> oh no im st^M>>> oh no im stu^M>>> oh no im stuc^M>>> oh no im stuck

(the ^M is actually the CR escape code in my terminal, shown as I copied the result from cat file.txt instead of the file's raw content)

The case where this trips me up is when I want to run something via risor, but forget the file as argument, pipe the result into something else, but then its just stuck.

Suggest an error like:

$ risor > file.txt
cannot show repl: stdout or stderr is not a tty