question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Control characters appearing in job output in 0.6.0

See original GitHub issue

I’m seeing control characters show up in coloured job output where previously there were none before. It seems that this could be somewhat related to #141.

Test environment

  • Jenkins Version: 2.148
  • AnsiColor Version: 0.6.0
  • Hostsystem: Debian stretch

Expected behavior

Up until 0.6.0 I would only occasionally see [0m characters show up and they did not affect output. The following appears when testing against 0.5.3

screen shot 2018-12-20 at 16 22 06

Actual behavior

With 0.6.0 I now see more control characters and in some cases no colour output at all:

screen shot 2018-12-20 at 16 08 49

In more complex jobs with more varied colour output, the colour output will not be properly bounded and will leak into following lines.

Steps to reproduce the behavior

The above outputs were reproduced by running the following job using the pipeline library:

def label = "terraform-${UUID.randomUUID().toString()}"

podTemplate(label: label, inheritFrom: 'jnlp', containers: [
  containerTemplate(
      name: 'terraform',
      image: 'hashicorp/terraform',
      ttyEnabled: true,
      command: 'cat',
      alwaysPullImage: true,
  )
]) {
    node(label) {
        container('terraform'){
            ansiColor('xterm') {
                sh """
                 terraform plan
                """
            }
        }
    }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
fearnycompknowhowcommented, Sep 9, 2021

It seems that Terraform attempts to format the output using color. However, Jenkins does not output this formatting correctly and thus you see those unusual characters in the output.

Thanks to this thread, I was able to make Terraform omit those characters in the output by using the -no-color flag.

This options is available for at least three of the major Terraform functions: show, plan, and apply. It’s probably available for others, I just haven’t confirmed it.

2reactions
dwnusbaumcommented, Jan 31, 2019

I just released 0.6.2 with a change that should improve this issue. If you are still seeing it after the upgrade, please copy-and-paste some of the broken output from Jenkins here (preferably replacing literal occurrences of the ASCII character 0x1b with the text 0x1b so we can see what is happening to the escape sequences).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control characters appear in data in Cognos Analytics 11 - IBM
When the database contains control character values (characters with ascii value 31 and under, or hex value 20 and under), they are displayed...
Read more >
Special Characters - L3HarrisGeospatial.com
Within the IDL environment, a number of characters have special meanings. ... The dollar sign character can appear anywhere a space is legal...
Read more >
Special Characters -- in a create user command - Ask TOM
I need to pass special characters into the password variable. ... Good job defining which special characters may and may not be used...
Read more >
unix - print distinct list of control characters in a file
Does anyone have a function (awk, bash, perl.etc) that could scan each line and then output (in octal, hex or ascii - either...
Read more >
How to replace ASCII special characters in SQL Server
Table 2 shows a sample list of the ASCII Control Characters. ... C# Console application shown in Script 4 that generates an output.txt...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found