Open cwjohnston opened 5 years ago
There was an issue with this fix. Reopening.
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
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.
There are still some bugs in Cobra preventing us from fixing this at the moment.
Waiting on https://github.com/spf13/cobra/pull/894 to get merged.
Still waiting on the cobra pr.
The Cobra PR got approved last week! It's still not merged yet, but here's hoping it happens soon!
I also wonder if https://github.com/sensu/sensu-go/issues/3782 would help here
upstream issue fixed and shipped in cobra 1.1.0
@fguimond @amdprophet did any of the recent work we've done on sensuctl/cobra 🐍 address this?
@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.
We should be able to fix this now by upgrading the version of Cobra we depend on.
Ok, great. Thanks for confirming. 👍
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)
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:
In a Windows 10 VM:
In a user's Windows 10 Powershell:
Same user's cmd terminal, also on Windows 10:
Your Environment