summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Mangano-Tarumi <fmang@mg0.fr>2020-07-27 14:43:48 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2021-02-20 17:24:30 +0100
commita1a742b518b7ead1ea32b13dd52d5ea5248e8bb5 (patch)
treee1c75d566b2359f16d05d0cbdeb11f806dc9bd66
parent445a991ef1b8c76fb1d51837c4fb692dbfb080e6 (diff)
downloadaur-a1a742b518b7ead1ea32b13dd52d5ea5248e8bb5.tar.gz
aur-a1a742b518b7ead1ea32b13dd52d5ea5248e8bb5.tar.xz
aurweb.spawn: Support stdout redirections to non-tty
Only ttys have a terminal size. If we can’t obtain it, we’ll just use 80 as a sane default. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rw-r--r--aurweb/spawn.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/aurweb/spawn.py b/aurweb/spawn.py
index 5da8587e..46d534d9 100644
--- a/aurweb/spawn.py
+++ b/aurweb/spawn.py
@@ -87,12 +87,16 @@ def start():
return
atexit.register(stop)
+ try:
+ terminal_width = os.get_terminal_size().columns
+ except OSError:
+ terminal_width = 80
print("{ruler}\n"
"Spawing PHP and FastAPI, then nginx as a reverse proxy.\n"
"Check out {aur_location}\n"
"Hit ^C to terminate everything.\n"
"{ruler}"
- .format(ruler=("-" * os.get_terminal_size().columns),
+ .format(ruler=("-" * terminal_width),
aur_location=aurweb.config.get('options', 'aur_location')))
# PHP