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

sensuctl tabular output looks terrible on some versions of Windows #2906

Open
cwjohnston opened this issue May 1, 2019 · 14 comments · Fixed by #2922
Open

sensuctl tabular output looks terrible on some versions of Windows #2906

cwjohnston opened this issue May 1, 2019 · 14 comments · Fixed by #2922
Assignees
Labels
component:sensuctl Sensu CLI improvements
Milestone

Comments

@cwjohnston
Copy link
Contributor

cwjohnston commented May 1, 2019

Expected Behavior

sensuctl tabular output should be easy for human operators to read

Current Behavior

sensuctl tabular output on certain versions/configurations of Windows prints "garbage characters"

Possible Solution

Detect terminal characteristics and adjust tabular output formatting accordingly

Steps to Reproduce (for bugs)

  1. On a Windows 10 system, configure sensuctl for a running backend, use tabular output format
  2. Run sensuctl list operations for any resource type
  3. Observe "garbage characters" in tabular output

Context

Garbage characters -- what I believe are control characters which aren't understood by the terminal -- make the output hard to read, increasing operator burden.

Thus far this seems to be a problem primarily on Windows 10.

In my Windows Server 2016 Data Center VM it looks fine:

2019-05-01 at 12 42 PM

In a Windows 10 VM:

2019-05-01 at 1 12 PM

In a user's Windows 10 Powershell:

image

Same user's cmd terminal, also on Windows 10:

image

Your Environment

  • Sensu version used (sensuctl, sensu-backend, and/or sensu-agent):
  • Installation method (packages, binaries, docker etc.):
  • Operating System and version (e.g. Ubuntu 14.04):
@amdprophet
Copy link
Member

There was an issue with this fix. Reopening.

@amdprophet amdprophet reopened this May 8, 2019
@amdprophet
Copy link
Member

It seems that Cobra doesn't allow for setting the output channel for normal output and errors independently. As a result, everything is sent to os.Stdout with this change. https://github.com/spf13/cobra/blob/5755ecf10233c1acfd87d417bc6605a30702c0a8/command.go#L260-L278

@jamesdphillips
Copy link
Contributor

Requires spf13/cobra#822

@amdprophet
Copy link
Member

We may want to add a test to ensure messages go to stdout/stderr correctly after fixing this so that we can avoid having to discover issues in QA.

@amdprophet
Copy link
Member

There are still some bugs in Cobra preventing us from fixing this at the moment.

@amdprophet
Copy link
Member

Waiting on spf13/cobra#894 to get merged.

@portertech
Copy link
Contributor

Still waiting on the cobra pr.

@calebhailey
Copy link

The Cobra PR got approved last week! It's still not merged yet, but here's hoping it happens soon!

@calebhailey
Copy link

I also wonder if #3782 would help here

@cwjohnston
Copy link
Contributor Author

upstream issue fixed and shipped in cobra 1.1.0

@portertech portertech added this to the 6.3.0 milestone Nov 16, 2020
@portertech portertech modified the milestones: 6.3.0, 6.4.0 Dec 7, 2020
@portertech portertech modified the milestones: 6.4.0, 6.5.0 Feb 5, 2021
@calebhailey
Copy link

@fguimond @amdprophet did any of the recent work we've done on sensuctl/cobra 🐍 address this?

@fguimond
Copy link
Contributor

@calebhailey - the issue is still there using the regular Windows command line (dos or PowerShell), however it does work with the new Windows Terminal https://www.microsoft.com/en-ca/p/windows-terminal/9n0dx20hk701?rtc=1&activetab=pivot:overviewtab.

@amdprophet
Copy link
Member

We should be able to fix this now by upgrading the version of Cobra we depend on.

@calebhailey
Copy link

Ok, great. Thanks for confirming. 👍

@portertech portertech modified the milestones: 6.5.0, 6.6.0 May 17, 2021
@calebhailey calebhailey modified the milestones: 6.next, 6.6.0 Sep 24, 2021
@calebhailey calebhailey removed this from the 6.6.0 milestone Nov 15, 2021
@calebhailey calebhailey added this to the 6.next milestone Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:sensuctl Sensu CLI improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants