Need way to disable REPL ANSI escape codes · Issue #5344 · nodejs/node-v0.x-archive (original) (raw)

This repository was archived by the owner on Apr 22, 2023. It is now read-only.

This repository was archived by the owner on Apr 22, 2023. It is now read-only.

@jart

Description

@jart

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:

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.