Please help to reset BOLD formatting for xTerm colors in bash script
See original GitHub issueI run a script that has some primitive formatting. After executing the script, the entire next output becomes bold (but not green). It doesn’t happen in a normal terminal. How to completely reset all formatting after some commands?
Test environment
- Jenkins Version: 2.150.2
- AnsiColor Version: 0.6.1
- Hostsystem: Ubuntu 16.04.4 LTS
Expected behavior
After closing ansiColor('xterm') { ... }
all further formatting should be reset to normal.
Actual behavior
Everything is bold after ansiColor is finished its work.
Steps to reproduce the behavior
pipeline {
agent { label 'worker' }
stages {
stage('colors') {
steps {
script {
ansiColor('xterm') {
writeFile file: 'script.sh', text: '''#!/usr/bin/env bash
RED="\\e[31m"
GREEN="\\e[32m"
BOLD="\\e[1m"
NORMAL="\\e[0m"
printf "${GREEN}${BOLD}"
printf "All updated ...\\n"
printf "${NORMAL}"
'''
sh '''
cat script.sh && chmod +x script.sh
'''
sh './script.sh'
}
println 'Why am I so bold?'
}
}
}
}
}
UP: The same happens if the plugin used inside options
section.
options {
ansiColor('xterm')
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
In an xterm, can I turn off bold or underline without resetting ...
The ${c_underline} escape sequence doesn't affect the color of the text; it only turns underlining on. ${c_nounderline} only turns underlining off.
Read more >FLOZz' MISC » bash:tip_colors_and_formatting
Bash tips: Colors and formatting (ANSI/VT100 Control sequences) ... please help. ... To correctly reset either bold or dim to normal on xterm, ......
Read more >bold text when using 256 colors - terminal - Unix StackExchange
"Boldness" is set separately from "foreground color", but it is not supported by Mutt. All you can do in Mutt is select a...
Read more >BASH Shell Change The Color of Shell Prompt on Linux or UNIX
This page explains how to set up or change the color of bash shell prompt by editing $PS1 variable on a Linux, *BSD,...
Read more >How can I change the colors of my xterm using Ansi escape ...
ANSI escape sequences consist of a sequence of characters beginning with the Escape character, character 27. The next character is often (though not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, let’s close this. If someone find the same problem and can isolate it, maybe he will reopen this or create a new ticket.
Thank you!
No, locally it works fine. Only in Jenkins everything is colored after some of receipts executed on ec2 instances using chef-solo. I don’t know when and why it happens.