util.human.io: Coerce $COLUMNS to number
authorKim Alvefur <zash@zash.se>
Fri, 07 Apr 2023 13:54:16 +0200
changeset 13055 164c2787901a
parent 13054 4ae759490e31
child 13056 585bd71a1a97
util.human.io: Coerce $COLUMNS to number os.getenv() returns a string but term_width() should return a number
util/human/io.lua
--- a/util/human/io.lua	Fri Apr 07 13:53:40 2023 +0200
+++ b/util/human/io.lua	Fri Apr 07 13:54:16 2023 +0200
@@ -109,7 +109,7 @@
 end
 
 local function term_width(default)
-	local env_cols = os.getenv "COLUMNS";
+	local env_cols = tonumber(os.getenv "COLUMNS");
 	if env_cols then return env_cols; end
 	local stty = io.popen("stty -a");
 	if not stty then return default; end