oxen-io/oxen-core

oxend uses ANSI escape sequences without regard for $TERM or isatty(3)

ianmacd opened this issue · 0 comments

Describe the bug

$ oxend print_height
2022-07-11 15:04:49.662	I Oxen 'Wistful Wagyu' (v10.1.2-d826fbee0-dev)
1100132

Looking at the above, h=$(oxend print_height | tail -n 1) ought to be a trivial operation, but it's not. I have to pipe oxend's output through sed or similar to de-ANSI-fy it. Otherwise:

$ h=`oxend print_height | tail -n 1`
$ echo $h
?2004l

oxend should respect $TERM (e.g. TERM=dumb) and use isatty(3) before deciding to use ANSI control sequences in its output.

At the very least, can we please have a --no-ansi flag or something similar for the purposes of scripting?