aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/human/io.lua2
-rw-r--r--util/prosodyctl/shell.lua2
2 files changed, 3 insertions, 1 deletions
diff --git a/util/human/io.lua b/util/human/io.lua
index 51a95ed5..e4bea63f 100644
--- a/util/human/io.lua
+++ b/util/human/io.lua
@@ -109,6 +109,8 @@ if utf8.len and utf8.offset then
end
local function term_width(default)
+ local env_cols = os.getenv "COLUMNS";
+ if env_cols then return env_cols; end
local stty = io.popen("stty -a");
if not stty then return default; end
local result = stty:read("*a");
diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua
index ed102d47..442ea2bd 100644
--- a/util/prosodyctl/shell.lua
+++ b/util/prosodyctl/shell.lua
@@ -30,7 +30,7 @@ local function read_line(prompt_string)
end
local function send_line(client, line)
- client.send(st.stanza("repl-input", { width = os.getenv "COLUMNS" or term_width() }):text(line));
+ client.send(st.stanza("repl-input", { width = term_width() }):text(line));
end
local function repl(client)