Commit a1a742b5 authored by Frédéric Mangano-Tarumi's avatar Frédéric Mangano-Tarumi Committed by Lukas Fleischer
Browse files

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's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 445a991e
...@@ -87,12 +87,16 @@ def start(): ...@@ -87,12 +87,16 @@ def start():
return return
atexit.register(stop) atexit.register(stop)
try:
terminal_width = os.get_terminal_size().columns
except OSError:
terminal_width = 80
print("{ruler}\n" print("{ruler}\n"
"Spawing PHP and FastAPI, then nginx as a reverse proxy.\n" "Spawing PHP and FastAPI, then nginx as a reverse proxy.\n"
"Check out {aur_location}\n" "Check out {aur_location}\n"
"Hit ^C to terminate everything.\n" "Hit ^C to terminate everything.\n"
"{ruler}" "{ruler}"
.format(ruler=("-" * os.get_terminal_size().columns), .format(ruler=("-" * terminal_width),
aur_location=aurweb.config.get('options', 'aur_location'))) aur_location=aurweb.config.get('options', 'aur_location')))
# PHP # PHP
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment