Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Need way to disable REPL ANSI escape codes #5344

Closed
jart opened this issue Apr 21, 2013 · 4 comments
Closed

Need way to disable REPL ANSI escape codes #5344

jart opened this issue Apr 21, 2013 · 4 comments

Comments

@jart
Copy link

jart commented Apr 21, 2013

The repl.js module needs to be smarter about how it sends ansi escape codes. For example if I run "coffee -i" (a command which uses the standard repl module) inside a dumb terminal that doesn't support ansi escape sequences, I see the following:

^[[1G^[[0Jcoffee> ^[[9G

This is ugly! Those ansi escape codes are unnecessary. Furthermore the repl module is not respecting the fact that I set NODE_NO_READLINE=1 to try and get rid of those escape codes. Because I'm running the coffee command, I do not have the ability to pass the "terminal: false" parameter to the repl.start() function so I have no way of making these codes go away.

Therefore I propose:

  1. If NODE_NO_READLINE is set, repl will not print ansi codes.
  2. If process.env['TERM'] is 'dumb' then repl will not print ansi codes.
@isaacs
Copy link

isaacs commented Apr 21, 2013

The coffee-script repl is not managed by Node. If you run node itself in a dumb terminal, it should not send ansi codes. If you set NODE_NO_READLINE then it also will not do anything fancy with control chars.

@isaacs
Copy link

isaacs commented Apr 21, 2013

Hm. My mistake, if TERM=dumb, it still sends color codes. So, that's a bug.

@sandinmyjoints
Copy link

👍

@jonslenkooyala
Copy link

I'm running node v0.12.2 on Mac OS X 10.9.5, inside a bash instance inside emacs (Ok, make fun of me). I am still getting (color) escape codes, I think??

tmp 509 $ echo $NODE_DISABLE_COLORS
1
tmp 510 $ node -v
v0.12.2
tmp 511 $ node
^[[1G^[[0J> ^[[3G
tmp 512 $ echo $TERM
dumb

silverwind pushed a commit to nodejs/node that referenced this issue Sep 22, 2015
This change stops the REPL from using ANSI control codes for colours
when the TERM environment variable is set to "dumb".

"dumb" is the terminal type with the smallest set of capabilities as
described by terminfo. See:

http://invisible-island.net/ncurses/terminfo.ti.html#toc-_Specials

Related: nodejs/node-v0.x-archive#5344
Related: nodejs/node-v0.x-archive#25506
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2712
rvagg pushed a commit to nodejs/node that referenced this issue Sep 22, 2015
This change stops the REPL from using ANSI control codes for colours
when the TERM environment variable is set to "dumb".

"dumb" is the terminal type with the smallest set of capabilities as
described by terminfo. See:

http://invisible-island.net/ncurses/terminfo.ti.html#toc-_Specials

Related: nodejs/node-v0.x-archive#5344
Related: nodejs/node-v0.x-archive#25506
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2712
@Trott Trott closed this as completed Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants