Merge ~kissiel/checkbox-support:xrandr-rotation-improv into checkbox-support:master

Proposed by Maciej Kisielewski
Status: Merged
Approved by: Maciej Kisielewski
Approved revision: 66a31225e4b4cdc503e61dd408fd3388ff5d6c57
Merged at revision: 0b8440cc5190190519630b13bfb1d77e726a3726
Proposed branch: ~kissiel/checkbox-support:xrandr-rotation-improv
Merge into: checkbox-support:master
Diff against target: 13 lines (+2/-0)
1 file modified
checkbox_support/contrib/xrandr.py (+2/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+368471@code.launchpad.net

Description of the change

xrandr: fix crashing when DISPLAY is not defined

Tested by running "from checkbox_support.contrib import xrandr" with and without having DISPLAY defined in environ.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/checkbox_support/contrib/xrandr.py b/checkbox_support/contrib/xrandr.py
2index eee9c4e..9a79f40 100644
3--- a/checkbox_support/contrib/xrandr.py
4+++ b/checkbox_support/contrib/xrandr.py
5@@ -977,6 +977,8 @@ class Screen(object):
6 def get_current_display():
7 """Returns the currently used display"""
8 display_url = os.getenv("DISPLAY")
9+ if display_url is None:
10+ raise SystemExit("DISPLAY environment variable is not defined!")
11 open_display = xlib.XOpenDisplay
12 # Set .argtypes and .restype, to ensure proper
13 # type check and conversion

Subscribers

People subscribed via source and target branches