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

Fix spinners on non-ansi terminals (windows, CI) #144

Closed
glennsarti opened this issue Jun 25, 2019 · 5 comments · Fixed by #514
Closed

Fix spinners on non-ansi terminals (windows, CI) #144

glennsarti opened this issue Jun 25, 2019 · 5 comments · Fixed by #514

Comments

@glennsarti
Copy link
Contributor

The spinners in Windows terminals are particularly annoying and mess up output e.g.

C:\Source\puppet-strings [use-litmus +2 ~2 -0 !]> bundle exec rake "litmus:provision[docker, centos:7]"
C:/Source/puppet-strings/.bundle/windows/ruby/2.5.0/gems/puppet-6.5.0-x64-mingw32/lib/puppet/util/windows/api_types.rb:6: warning: already initialized constant FFI::WIN32_FALSE
C:/Source/puppet-strings/.bundle/windows/ruby/2.5.0/gems/pdk-1.10.0/lib/pdk/util/windows/api_types.rb:6: warning: previous definition of WIN32_FALSE was here
C:/Source/puppet-strings/.bundle/windows/ruby/2.5.0/gems/puppet-6.5.0-x64-mingw32/lib/puppet/util/windows/api_types.rb:9: warning: already initialized constant FFI::ERROR_SUCCESS
C:/Source/puppet-strings/.bundle/windows/ruby/2.5.0/gems/pdk-1.10.0/lib/pdk/util/windows/api_types.rb:9: warning: previous definition of ERROR_SUCCESS was here
 Provisioning centos:7 using docker provisioner.[|]Cloning into 'spec/fixtures/modules/facts'...
Cloning into 'spec/fixtures/modules/provision'...
Cloning into 'spec/fixtures/modules/puppet_agent'...
 Provisioning centos:7 using docker provisioner.[\]remote: Enumerating objects: 34, done.
remote: Counting objects:  88% (30/34)                                                                                        remote: Counting objects:   8% (6/69)                                                                                         remote: Counting objects: 100% (69/69), done.
remote: Compressing objects: 100% (54/54), done.
remote: Compressing objects: 100% (28/28), done.
Receiving objects:  88% (30/34)    15 (delta 2), pack-reused 0 eceiving objects:  85% (29/34)
Receiving objects: 100% (34/34), 21.28 KiB | 4.25 MiB/s, done.
Resolving deltas: 100% (7/7), done.
remote: Enumerating objects: 182, done.Rremote: Total 69 (delta 7), reused 48 (delta 4), pack-reused 0                        Receiving objects: 100% (69/69), 28.49 KiB | 140.00 KiB/s, done.


Resolving deltas: 100% (7/7), done.82)    esolving deltas:   0% (0/7)
remote: Counting objects: 100% (182/182), done.
remote: Compressing objects: 100% (159/159), done.
Receiving objects:  90% (164/182)    103 (delta 12), pack-reused 0
Receiving objects: 100% (182/182), 127.03 KiB | 631.00 KiB/s, done.
Resolving deltas: 100% (22/22), done.provisioner.[-]esolving deltas:   0% (0/22)
 Provisioning centos:7 using docker provisioner.[/]

Is there an easy way to disable them? If so, why is it not documented?

@tphoney
Copy link
Contributor

tphoney commented Jun 26, 2019

Hi @glennsarti does this affect all commands that have spinners, or just provisioning ?
@florindragos what are your thoughts on this ?

@glennsarti
Copy link
Contributor Author

@tphoney I would hazard a guess anything. Windows consoles and spinners have never played nicely.

But that aside, it should be a UX feature to disable these kinds of things to make logging and like more sane. e.g. I can't pipe stdout to a file with spinners :(

@florindragos
Copy link
Contributor

Is there a (cross platform?) way maybe we could check if the session is interactive and only display the spinner in that case?

@ekohl
Copy link
Contributor

ekohl commented Jun 27, 2019

It looks like STDOUT.tty? is the easiest way:

$ cat test.rb 
puts STDOUT.tty?
$ ruby test.rb 
true
$ ruby test.rb  | sort
false

I don't have access to a Windows machine to check.

@DavidS
Copy link
Contributor

DavidS commented May 22, 2020

STDOUT.tty? is mostly good, except for CI systems that emulate a TTY to capture colored output (like travis and github actions), but don't provide the actual terminal support to deal with the spinners. The PDK has some code to deal with that already.

@DavidS DavidS changed the title Add easy way to disable spinners Fix spinners on non-ansi terminals (windows, CI) May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants