-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Nushell panic when printing empty table or array to zero column pty #15328
Comments
if there are no rows and no columns there is no place to render anything. having a terminal width is important to table structures so that it knows how to draw columns and wrap data. i'm not sure how this could work otherwise. |
But when nushell is running in without a pty, it actually prints out the table. Maybe we should reuse that special handling for 0-wdith pty? Easiest way to reproduce this is inside docker without
Not sure what size it's assuming pty is. Tried to print a wide table but the width is 92
|
I really have no idea how output can work with 0 columns and 0 rows. I mean, I believe what you're saying. I'm just not sure how that works because the table command has to know how wide the table is to draw it. I'm sure it has defaults which I thought were 80x24 but could be wrong. |
I have a similar problem. When I use "nu -c 'echo "test"' inside a act workflow (inside a gitea ci chain) I get this error from nushell while I can run everything else just fine. This is what I run
This is what I get from this:
Clearly Nushell is the black sheep here and not useable in a CI workflow which is a shame! Maybe we could for a size using some command? Could be handy in other cases too. EDIT:
Maybe we could get some "to tty 80 25" that renders it to text with that size? |
Describe the bug
On a zero column pty, nushell would panic when running
print ({})
orprint ([])
How to reproduce
I'm not really familiar with how to setup pty so just grabbed a go library to do this for me. Might have easier way to replicate this bug.
go run main.go
Output for the run is:
Tweak the nu script in
main.go
, tests shows following outcome:[]
: Panic{}
: Panic[0]
: WarningCouldn't fit table into 0 columns!
{a: b}
: WarningCouldn't fit table into 0 columns!
Expected behavior
I expect nu to not panic in this situation. Would be better if nu can fallback zero-width pty to non-interactive environment and print tables info instead of showing a warning.
CircleCI is actually creating a zero-width pty for running commands. Not sure about other CI systems.
Configuration
The text was updated successfully, but these errors were encountered: