-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
terminal: disable terminal progress plugin on iTerm2 #13897
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
base: main
Are you sure you want to change the base?
Conversation
f2316b3 to
c37e687
Compare
| if reporter.isatty(): | ||
| plugin = TerminalProgressPlugin(reporter) | ||
| config.pluginmanager.register(plugin, "terminalprogress") | ||
| # Some terminals interpret OSC 9;4 as desktop notification, | ||
| # skip on those we know (#13896). | ||
| should_skip_terminal_progress = ( | ||
| # iTerm2 (reported on version 3.6.5). | ||
| "ITERM_SESSION_ID" in os.environ | ||
| ) | ||
| if not should_skip_terminal_progress: | ||
| plugin = TerminalProgressPlugin(reporter) | ||
| config.pluginmanager.register(plugin, "terminalprogress") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels overly nested. How about
| if reporter.isatty(): | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") | |
| # Some terminals interpret OSC 9;4 as desktop notification, | |
| # skip on those we know (#13896). | |
| should_skip_terminal_progress = ( | |
| # iTerm2 (reported on version 3.6.5). | |
| "ITERM_SESSION_ID" in os.environ | |
| ) | |
| if not should_skip_terminal_progress: | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") | |
| # Some terminals interpret OSC 9;4 as desktop notification, | |
| # skip on those we know (#13896). | |
| should_skip_terminal_progress = ( | |
| # iTerm2 (reported on version 3.6.5). | |
| "ITERM_SESSION_ID" in os.environ | |
| ) or not reporter.isatty() | |
| if should_skip_terminal_progress: | |
| return | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to avoid early return in hooks because it's possible we add more unrelated stuff to it in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So
| if reporter.isatty(): | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") | |
| # Some terminals interpret OSC 9;4 as desktop notification, | |
| # skip on those we know (#13896). | |
| should_skip_terminal_progress = ( | |
| # iTerm2 (reported on version 3.6.5). | |
| "ITERM_SESSION_ID" in os.environ | |
| ) | |
| if not should_skip_terminal_progress: | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") | |
| # Some terminals interpret OSC 9;4 as desktop notification, | |
| # skip on those we know (#13896). | |
| enable_terminal_progress = ( | |
| # iTerm2 (reported on version 3.6.5). | |
| "ITERM_SESSION_ID" not in os.environ | |
| ) and reporter.isatty() | |
| if enable_terminal_progress: | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") |
then?
Fix #13896