DarthSim / overmind

Process manager for Procfile-based applications and tmux
MIT License
2.78k stars 79 forks source link

Correct terminal width does not seem to be properly forwarded to child processes #146

Open Hubro opened 1 year ago

Hubro commented 1 year ago

I'm using Python's Rich library to show log output while I'm developing. This library uses the terminal width to place certain information at the very right edge of the screen.

This works great, even in tmux, but when launched through overmind or hivemind:

image

I tried exporting COLUMNS to the correct value for my current terminal, just to see what would happen:

image

This value seems to be picked up by Rich, since running the command directly still works, and the Python command in hivemind now thinks it has 123 columns to work with even though hivemind itself eats some of those. It has no effect when running the command using overmind.

It seems like the terminal size isn't being correctly forwarded to the Python process.

Should this be working? If yes, how can I troubleshoot this further?


I'm using kitty 0.26.5, $TERM is set to xterm-kitty. I also tested with xfce4-terminal with $TERM set to xterm-256color and the result was identical.


Example Python application to reproduce the problem:

pyproject.toml:

[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
rich = "^13.2.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

test.py:

import logging
from rich.logging import RichHandler

FORMAT = "%(message)s"
logging.basicConfig(
    level="NOTSET", format=FORMAT, datefmt="[%X]", handlers=[RichHandler()]
)

log = logging.getLogger("test")
log.info("Hello, World!")

Procfile:

test: poetry run python test.py
DarthSim commented 1 year ago

Wow, this is a nice description! Thanks! v2.4.0 sets the proper size for tmux windows

Hubro commented 1 year ago

Wow, this is a nice description! Thanks! v2.4.0 sets the proper size for tmux windows

Awesome :tada: overmind 2.4.0 fixed the issue!

image

Is a similar fix possible for Hivemind? :slightly_smiling_face:

DarthSim commented 1 year ago

I'd not say it's impossible, yet it's much more complex