Skip to content

Commit eb69920

Browse files
committed
Allow extra wait time for Xvfb if needed, up to a maximum
1 parent 3ba3172 commit eb69920

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

nipype/interfaces/base.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -994,9 +994,14 @@ def run(self, **inputs):
994994
xvfb_proc = subprocess.Popen(xvfb_cmd,
995995
stdout=open(os.devnull),
996996
stderr=open(os.devnull))
997-
time.sleep(0.2) # give Xvfb time to start
998-
if xvfb_proc.poll() is not None:
999-
raise Exception('Error: Xvfb did not start')
997+
wait_step = 0.2
998+
max_wait = 10
999+
wait_time = 0
1000+
while xvfb_proc.poll() is not None:
1001+
if wait_time > max_wait: # raise Exception if past maximum wait time
1002+
raise Exception('Error: Xvfb did not start')
1003+
time.sleep(wait_step) # give Xvfb time to start
1004+
wait_time += wait_step
10001005

10011006
runtime.environ['DISPLAY'] = ':%s' % vdisplay_num
10021007

0 commit comments

Comments
 (0)