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

Disable spinner in non interactive mode #1467

Merged
merged 1 commit into from
Nov 12, 2021
Merged

Disable spinner in non interactive mode #1467

merged 1 commit into from
Nov 12, 2021

Conversation

Zaharid
Copy link
Contributor

@Zaharid Zaharid commented Nov 11, 2021

Print something to the terminal instead. This avoids needlessly
cluttering CI outputs.

Example

import time
import sys
import subprocess

from validphys.renametools import Spinner

with Spinner():
    time.sleep(5)

if sys.argv[-1] != "no":
    print(
        subprocess.run(
            [sys.executable, __file__, "no"], capture_output=True, text=True
        ).stdout
    )

Print something to the terminal instead. This avoids needlessly
cluttering CI outputs.

Example

```python
import time
import sys
import subprocess

from validphys.renametools import Spinner

with Spinner():
    time.sleep(5)

if sys.argv[-1] != "no":
    print(
        subprocess.run(
            [sys.executable, __file__, "no"], capture_output=True, text=True
        ).stdout
    )
```
@Zaharid Zaharid added the enhancement New feature or request label Nov 11, 2021
@@ -12,6 +12,10 @@ class Spinner:
""" Context manager to provide a spinning cursor
while validphys performs some other task silently.

When exececuted in a TTY, it shows a spinning cursor for the duration of
Copy link
Contributor

Choose a reason for hiding this comment

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

What's TTY?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Zaharid Zaharid merged commit 1b9dd82 into master Nov 12, 2021
@Zaharid Zaharid deleted the nospinner branch November 12, 2021 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants