Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/xvfb.py
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-28 01:55:44 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-28 01:55:44 (GMT)
commitd032214da568917663d3c2aa515214cf30664f26 (patch)
tree4747b2053ad4c5c05a1140e23657a1a0e28f5bef /devbot/xvfb.py
parentc7749aeaeafa217c838b65a3848548647aa06e89 (diff)
Split out xvfb
Diffstat (limited to 'devbot/xvfb.py')
-rw-r--r--devbot/xvfb.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/devbot/xvfb.py b/devbot/xvfb.py
new file mode 100644
index 0000000..6549b9d
--- /dev/null
+++ b/devbot/xvfb.py
@@ -0,0 +1,23 @@
+import os
+import subprocess
+
+from devbot import utils
+
+xvfb_display = ":100"
+
+def start():
+ xvfb_proc = subprocess.Popen(args=["Xvfb", xvfb_display],
+ stdout=utils.devnull,
+ stderr=subprocess.STDOUT)
+ orig_display = os.environ.get("DISPLAY", None)
+ os.environ["DISPLAY"] = xvfb_display
+
+ return (xvfb_proc, orig_display)
+
+def stop(xvfb_proc, orig_display):
+ if orig_display:
+ os.environ["DISPLAY"] = xvfb_display
+ else:
+ del os.environ["DISPLAY"]
+
+ xvfb_proc.terminate()