File tree Expand file tree Collapse file tree 2 files changed +7
-26
lines changed Expand file tree Collapse file tree 2 files changed +7
-26
lines changed Original file line number Diff line number Diff line change @@ -983,32 +983,12 @@ def run(self, **inputs):
983
983
version = self .version )
984
984
try :
985
985
if self ._redirect_x :
986
- exist_val , _ = self ._exists_in_path ('Xvfb' ,
987
- runtime .environ )
988
- if not exist_val :
989
- raise IOError ("Xvfb could not be found on host %s" %
990
- (runtime .hostname ))
991
- else :
992
- vdisplay_num = _search_for_free_display ()
993
- xvfb_cmd = ['Xvfb' , ':%d' % vdisplay_num ]
994
- xvfb_proc = subprocess .Popen (xvfb_cmd ,
995
- stdout = open (os .devnull ),
996
- stderr = open (os .devnull ))
997
- wait_step = 0.2
998
- wait_time = 0
999
- while xvfb_proc .poll () is not None :
1000
- if wait_time > config .get ('execution' , 'xvfb_max_wait' ):
1001
- raise Exception ('Error: Xvfb did not start' )
1002
- time .sleep (wait_step ) # give Xvfb time to start
1003
- wait_time += wait_step
1004
-
1005
- runtime .environ ['DISPLAY' ] = ':%s' % vdisplay_num
1006
-
1007
- runtime = self ._run_interface (runtime )
1008
-
1009
- if self ._redirect_x :
1010
- xvfb_proc .kill ()
1011
- xvfb_proc .wait ()
986
+ from xvfbwrapper import Xvfb
987
+ with Xvfb () as xvfb :
988
+ runtime = self ._run_interface (runtime )
989
+ else :
990
+ iflogger .warn ('Error redirecting X, trying without xvfb...' )
991
+ runtime = self ._run_interface (runtime )
1012
992
1013
993
outputs = self .aggregate_outputs (runtime )
1014
994
runtime .endTime = dt .isoformat (dt .utcnow ())
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ traits>=4.0
5
5
python-dateutil >= 1.5
6
6
nibabel >= 1.0
7
7
nose >= 1.0
8
+ xvfbwrapper >= 0.2
You can’t perform that action at this time.
0 commit comments