[gm.py] Check for $DISPLAY before showing notifications

This improves the experience over an SSH connection.

No-Try: true
Change-Id: Id6971f2ad2c75c85f91bea71f7215ce7a948ee71
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3586987
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79992}
This commit is contained in:
Jakob Kummerow 2022-04-14 16:21:33 +02:00 committed by V8 LUCI CQ
parent 7dd7100502
commit 302e540879

View File

@ -243,7 +243,8 @@ def _Write(filename, content):
f.write(content)
def _Notify(summary, body):
if _Which('notify-send') is not None:
if (_Which('notify-send') is not None and
os.environ.get("DISPLAY") is not None):
_Call("notify-send '{}' '{}'".format(summary, body), silent=True)
else:
print("{} - {}".format(summary, body))