ctubbsii commented on code in PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#discussion_r3424137578
##########
hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh:
##########
@@ -375,9 +375,11 @@ function hadoop_generic_columnprinter
if [[ -n "${COLUMNS}" ]]; then
numcols=${COLUMNS}
- else
- numcols=$(tput cols) 2>/dev/null
- COLUMNS=${numcols}
+ elif command -v tput >/dev/null 2>&1; then
+ numcols=$(tput cols 2>/dev/null)
+ if [[ "${numcols}" =~ ^[0-9]+$ ]]; then
+ COLUMNS=${numcols}
+ fi
Review Comment:
This code change looks fine, but I'm not sure how useful it is. tput is
pretty common, and it's really not a problem to assume it's there as a
prerequisite.
That said, the curlies and the quotes on the left side of the if statement
aren't needed, nor are the curlies in the assignment to COLUMNS, but there
seems to be an excess of these unnecessary things throughout the script, so
these aren't really that much of a problem.
##########
hadoop-common-project/hadoop-common/src/test/scripts/hadoop_subcommands.bats:
##########
Review Comment:
I don't know how the test works, so I didn't check it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]