ANSI escape sequences are not output to standard output on Windows

I am trying to write an ANSI escape sequence for stdout using node.js on Windows, but it does not work.

In particular, I use ConEmu , which support is a subset of ANSI codes. I created a test file that should rename the current console tab:

process.stdout.write('\x1b]9;3;"abc"\x1b\x5c');

However, nothing happens when I run it. If I run node test > out.txt, the correct bytes are written to the output file.

Why don't escape sequences work?

+1
source share
1 answer

node stdout (.. ), , process.stdout, . , node test > out.txt .

, node Windows, ( libuv) escape- ANSI, TTY Unix Windows API. , , , Windows, Windows escape- ANSI.

.

, JS- process.stdout.write() WriteConsoleW() ( node ).

, fd 1.

var rawStdout = new fs.SyncWriteStream(1, { autoClose: false });

ANSI rawStdout .

rawStdout.write('\x1b]9;3;"abc"\x1b\x5c');

(, Windows - , . , escape- ANSI.)


, , : console-title — , ANSI escape- unix API Windows. Windows , ConEmu.

+5

All Articles