Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle get_pty_slave failure gracefully #90

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

parsiad
Copy link

@parsiad parsiad commented Apr 15, 2023

Inside neovim, the command

:python3 from ueberzug.process import get_pty_slave; import os; print(get_pty_slave(os.getppid()))

outputs None. On an arbitrary terminal, it returns the correct pts path.

I haven't looked into why this occurs, but a simple fix is to fail gracefully in this case instead of firing an assertion.

@WhiteBlackGoose
Copy link
Collaborator

Hi, thanks for the PR. How does it affect the usage of the plugin? 😅

Just to understand the issue being solved

@WhiteBlackGoose
Copy link
Collaborator

Oh, I see #92

@phcerdan
Copy link

phcerdan commented Sep 3, 2023

Please merge @WhiteBlackGoose , _get_char_pixelsize is used as a hint, returning None is good enough, no need to throw.

I am facing this issue even when vim.g.magma_image_provider="kitty".
Testing this PR locally and ImageOutputChunk is properly displayed. Before this I was getting the assert failure.

For context, I have ueberzug installed in my system python, and magma was failing with this error always, except when opening nvim inside a virtual environment WITHOUT ueberzug (because the function _get_char_pixelsize returned None earlier, before hitting the assert). In the venv without ueberzug, the image was displayed correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants