commit:     8447b39c08cd1cf2630fbce627594c54b373f0e5
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Feb 11 00:14:57 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Feb 11 01:29:29 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=8447b39c

Guard against errexit in the course of reading from stty(1)

Otherwise, it will only be a matter of time before a devotee of the
cult of set -e begins complaining.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 functions.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/functions.sh b/functions.sh
index 241f238..eb9a168 100644
--- a/functions.sh
+++ b/functions.sh
@@ -468,7 +468,9 @@ else
        # size operand is not portable.
        COLS=$(
                stty size 2>/dev/null | {
-                       read -r h w _ && printf '%s\n' "$w"
+                       if read -r h w _; then
+                               printf '%s\n' "$w"
+                       fi
                }
        )
        if ! is_int "${COLS}" || [ "${COLS}" -le 0 ]; then

Reply via email to