-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nodejs STILL sends ANSI escape sequences to dumb terminals. #26187
Comments
As a workaround, I've created a C program to filter out the escape sequences. After compiling, you can invoke the Node REPL like this:
|
I can't duplicate this. If the output is a pipe or |
What is your stdout connected to? The escape sequences I'm seeing are for positioning the cursor, not styling the text, and they move the cursor to where it already is (just as seen in the original bug report), so if your stdout is a terminal that supports escape sequences there would be no visible effect. The REPL output would look unstyled. |
Do you have a reproducible example, preferably without 3rd party modules? |
I reproduced the behaviour, it's present when node is running in TTY There are missing checks in I made fix for the issue, with tests for each subsystem. I added explicit support for dumb terminals in readline(use
My PR: #26261 About supported features of the dumb terminals: |
When TERM=dumb and .isTTY=true don't use ANSI escape codes and ignore all keys, except 'escape', 'return' and 'ctrl-c'. Fixes: nodejs#26187
When TERM=dumb and .isTTY=true don't use ANSI escape codes and ignore all keys, except 'escape', 'return' and 'ctrl-c'. PR-URL: nodejs#26261 Fixes: nodejs#26187 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
PR-URL: nodejs#26261 Fixes: nodejs#26187 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Version:
v12.0.0-nightly201902173fbf55a87c
Platform:
Linux pop-os 4.18.0-14-generic domain: add arguments for the function in domain.run() #15~18.04.1-Ubuntu SMP Mon Jan 14 11:09:26 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Subsystem:
My problem is described here: nodejs/node-v0.x-archive#5344
The only difference is I'm running the latest version of Node in 2019, presumably after patches have been applied that were supposed to have fixed the problem.
I'm running the REPL from the command line in an Emacs
*shell*
buffer. I have$NODE_DISABLE_COLORS
set to 1, which doesn't matter because the�[3G
escape sequence isn't a color code (those end inm
).#2712 doesn't look like it fixes the problem. That seems to just be the implementation of the
$NODE_DISABLE_COLORS
option.The text was updated successfully, but these errors were encountered: