Adding nolisten

This commit is contained in:
Miljan Karadzic 2013-05-12 22:46:01 +02:00
parent 4101e73abc
commit ffa44e576d
1 changed files with 6 additions and 1 deletions

View File

@ -18,10 +18,11 @@ import time
class Xvfb: class Xvfb:
def __init__(self, width=800, height=680, colordepth=24): def __init__(self, width=800, height=680, colordepth=24, nolisten=None):
self.width = width self.width = width
self.height = height self.height = height
self.colordepth = colordepth self.colordepth = colordepth
self.nolisten = nolisten
self.proc = None self.proc = None
if 'DISPLAY' in os.environ: if 'DISPLAY' in os.environ:
@ -35,6 +36,10 @@ class Xvfb:
'Xvfb', ':%d' % (self.vdisplay_num,), '-screen', '0', 'Xvfb', ':%d' % (self.vdisplay_num,), '-screen', '0',
'%dx%dx%d' % (self.width, self.height, self.colordepth) '%dx%dx%d' % (self.width, self.height, self.colordepth)
] ]
if self.nolisten:
self.xvfb_cmd = self.xvfb_cmd + ['-nolisten', self.nolisten]
self.proc = subprocess.Popen(self.xvfb_cmd, self.proc = subprocess.Popen(self.xvfb_cmd,
stdout=open(os.devnull), stdout=open(os.devnull),
stderr=open(os.devnull)) stderr=open(os.devnull))