Skip to content

Commit b43e29d

Browse files
authored
Default to 'off' when invoked on an obviously SSH shell (#76)
While this doesn't determine if invoked over an SSH shell with 100% certainty (like if sudo is involved), it's a trivial hint that the user probably doesn't want desktop notifications enabled. Note that the behavior can still be specified either way, we're just changing the default behavior here.
1 parent e535828 commit b43e29d

File tree

1 file changed

+9
-0
lines changed
  • colcon_notification/event_handler/desktop_notification

1 file changed

+9
-0
lines changed

colcon_notification/event_handler/desktop_notification/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ def __init__(self): # noqa: D107
3232
super().__init__()
3333
satisfies_version(
3434
EventHandlerExtensionPoint.EXTENSION_POINT_VERSION, '^1.0')
35+
36+
# default to disabled over SSH
37+
self.enabled = not any(
38+
os.getenv(var) for var in (
39+
'SSH_TTY',
40+
'SSH_CLIENT',
41+
'SSH_CONNECTION',
42+
))
43+
3544
self._any_stderr_output = False
3645
self._any_test_failure = False
3746
self._failed = []

0 commit comments

Comments
 (0)