Skip to content

Commit e74c46e

Browse files
authored
Use local scope for variables in output helpers (#1719)
Since `read` defines the `line variable as global by default, meaning `line` was visible outside these functions.
1 parent c4e4a4f commit e74c46e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/output.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function output::indent() {
4040
# EOF
4141
# ```
4242
function output::notice() {
43+
local line
4344
echo >&2
4445
while IFS= read -r line; do
4546
echo -e "${ANSI_BLUE} ! ${line}${ANSI_RESET}" >&2
@@ -58,6 +59,7 @@ function output::notice() {
5859
# EOF
5960
# ```
6061
function output::warning() {
62+
local line
6163
echo >&2
6264
while IFS= read -r line; do
6365
echo -e "${ANSI_YELLOW} ! ${line}${ANSI_RESET}" >&2
@@ -76,6 +78,7 @@ function output::warning() {
7678
# EOF
7779
# ```
7880
function output::error() {
81+
local line
7982
echo >&2
8083
while IFS= read -r line; do
8184
echo -e "${ANSI_RED} ! ${line}${ANSI_RESET}" >&2

0 commit comments

Comments
 (0)