Alex
Alex

Reputation: 171

What does \u001b[1G\u001b[2K> mean?

I'm running through some javascript code and during testing I received this sequence: \u001b[1G\u001b[2K> . The entire line was actual: tests\\repl\u001b[1G\u001b[2K> tests\\replTest.js, expected: tests\replTest.js

What does this mean?

Upvotes: 2

Views: 3238

Answers (1)

BambooleanLogic
BambooleanLogic

Reputation: 8171

Those are unparsed ANSI control codes.

  • \u001b[1G is a "Cursor Horizontal Absolute" code. The 1 means it tries to move the cursor to the first character of the line.
  • \u001b[2K is a "Erase in Line" code. The 2 makes it mean "Erase the entire line".

It looks like a Unicode escaped dump of the input to a console where someone started typing tests\repl, then erased the whole line and instead wrote > tests\replTest.js. Could also be the redirect of the console to a file.

Upvotes: 10

Related Questions