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

cli: Use glint to determine if os.Stdout is tty #10926

Merged
merged 4 commits into from
Jul 23, 2021
Merged

cli: Use glint to determine if os.Stdout is tty #10926

merged 4 commits into from
Jul 23, 2021

Conversation

notnoop
Copy link
Contributor

@notnoop notnoop commented Jul 22, 2021

Use glint to determine if os.Stdout is a terminal.

glint Terminal renderer expects os.Stdout not only to be a terminal, but also to have non-zero size. It's unclear how this condition arises, but this additional check causes Nomad to render deployments progress through glint when glint cannot support it.

By using golint to perform the check, we eliminate the risk of mis-judgement.

I opened mitchellh/go-glint#4 to fix the panic upstream: mitchellh/go-glint#4 . The upstream fix isn't sufficient for us, as it would just skip rendering deployments in this condition, instead of going the non-terminal rendering path in Nomad.

Fixes #10923

Copy link
Contributor

@isabeldepapel isabeldepapel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


d.RenderFrame()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silly question, but why is RenderFrame() getting called here--does it have to do with calculating the terminal size?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent question actually. It doesn't belong here! I added it for debugging to force the rendering in main thread rather than in a goroutine!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic when using nomad job stop
2 participants