node-pty icon indicating copy to clipboard operation
node-pty copied to clipboard

ANSI escape doesn't work

Open MassMessage opened this issue 3 years ago • 0 comments

Environment details

  • OS: Windows 11 Home Insider Preview Single Language
  • OS version: Windows 11
  • node-pty version: 0.10.1

Issue description

i'm trying to use ANSI escapes like "\x1B[31mTexting\x1b[0m\t\t" to print a green text in the powershell terminal but it isn't working; it just print the text in the default color. What am I missing? i'm doing something like this:

var os = require('os');
var pty = require('node-pty');

var shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';

var ptyProcess = pty.spawn(shell, [], {
  name: 'xterm-color',
  cols: 80,
  rows: 30,
  cwd: process.env.HOME,
  env: process.env
});
ptyProcess.write("\x1B[31mTexting\x1b[0m\t\t");

MassMessage avatar Jul 19 '22 19:07 MassMessage