diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-08 18:54:17 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-08 18:54:17 (GMT) |
commit | cbd01b3fe4ecee048fed73586a8d0898e7ec4fb0 (patch) | |
tree | cb75b412e3d3e8a0d72453ff14bc35e753072f40 /devbot | |
parent | e1e17b4a5895852f23b7dd9a2d98be3cdd1c6272 (diff) |
Use xdpyinfo to find a free display
We cannot use SugarRunner in check-sytem, too early.
Diffstat (limited to 'devbot')
-rw-r--r-- | devbot/xvfb.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/devbot/xvfb.py b/devbot/xvfb.py index eed1468..a70b4c8 100644 --- a/devbot/xvfb.py +++ b/devbot/xvfb.py @@ -1,12 +1,19 @@ import os import subprocess -from gi.repository import SugarRunner - from devbot import utils +def _find_free_display(): + for i in range (100, 1000): + display = ":%s" % i + result = subprocess.call(args=["xdpyinfo", "--display", display], + stdout=utils.devnull, + stderr=subprocess.STDOUT) + if result > 0: + return display + def start(): - xvfb_display = SugarRunner.find_free_display() + xvfb_display = _find_free_display() xvfb_proc = subprocess.Popen(args=["Xvfb", xvfb_display], stdout=utils.devnull, stderr=subprocess.STDOUT) |