Skip to contentSkip to conversation

pkg-utils: mask tput failure for non-interactive sessions

PATCH New James Knight 3 participants 3 messages Feb 21, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pkg-utils: mask tput failure for non-interactive sessions

When invoking a build from a non-interactive session (for example, a Jenkins build), there is no terminal session to modify. When preparing variables to track the bold and boldoff mode sequences, the tput command will always fail as there is no terminal to query. The following change masks the error message when tput fails; leaving the TERM_BOLD and TERM_RESET variables empty.

---
Changes v1 -> v2:
- Removed space in stderr redirection (suggested by Yann E. MORIN).

---
 package/pkg-utils.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-utils.mk +2 -2
index 44bd2c9..f88313a 100644
@@ -84,8 +84,8 @@ suitable-extractor = $(INFLATE$(suffix $(1)))
 
 # MESSAGE Macro -- display a message in bold type
 MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(call qstrip,$(1))$(TERM_RESET)"
-TERM_BOLD := $(shell tput smso)
-TERM_RESET := $(shell tput rmso)
+TERM_BOLD := $(shell tput smso 2>/dev/null)
+TERM_RESET := $(shell tput rmso 2>/dev/null)
 
 # Utility functions for 'find'
 # findfileclauses(filelist) => -name 'X' -o -name 'Y'
Signature · 1 line
1.9.5.msysgit.1
#1 lore raw

PATCH v2 1/1 pkg-utils: mask tput failure for non-interactive sessions

James, All,

On 2016-02-21 11:04 -0500, James Knight spake thusly:

Quoted 8 lines

When invoking a build from a non-interactive session (for example, a Jenkins build), there is no terminal session to modify. When preparing variables to track the bold and boldoff mode sequences, the tput command will always fail as there is no terminal to query. The following change masks the error message when tput fails; leaving the TERM_BOLD and TERM_RESET variables empty.

Regards,
Yann E. MORIN.

Quoted 29 lines

---
Changes v1 -> v2:
- Removed space in stderr redirection (suggested by Yann E. MORIN).

---
 package/pkg-utils.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-utils.mk +2 -2
index 44bd2c9..f88313a 100644
@@ -84,8 +84,8 @@ suitable-extractor = $(INFLATE$(suffix $(1)))
 
 # MESSAGE Macro -- display a message in bold type
 MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(call qstrip,$(1))$(TERM_RESET)"
-TERM_BOLD := $(shell tput smso)
-TERM_RESET := $(shell tput rmso)
+TERM_BOLD := $(shell tput smso 2>/dev/null)
+TERM_RESET := $(shell tput rmso 2>/dev/null)
 
 # Utility functions for 'find'
 # findfileclauses(filelist) => -name 'X' -o -name 'Y'
Signature · 6 lines
1.9.5.msysgit.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v2 1/1 pkg-utils: mask tput failure for non-interactive sessions

In reply to James Knight

Dear James Knight,

Quoted 7 lines · James Knight

When invoking a build from a non-interactive session (for example, a Jenkins build), there is no terminal session to modify. When preparing variables to track the bold and boldoff mode sequences, the tput command will always fail as there is no terminal to query. The following change masks the error message when tput fails; leaving the TERM_BOLD and TERM_RESET variables empty.

Quoted 7 lines

---
Changes v1 -> v2:
- Removed space in stderr redirection (suggested by Yann E. MORIN).

---
 package/pkg-utils.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com