@@ -100,14 +100,14 @@ def execute_with_realtime_output(command, directory, env=None):
100
100
101
101
if p .returncode != 0 :
102
102
print ('Exiting as the last command failed' )
103
- exit (p .returncode )
103
+ # exit(p.returncode)
104
104
105
105
106
106
107
107
sys .path .append (os .environ ['C302_HOME' ])
108
108
109
109
try :
110
- os .system ('xhost +' )
110
+ os .system ('echo Granting permissions for xhost && xhost +' )
111
111
except :
112
112
print ("Unexpected error: %s" % sys .exc_info ()[0 ])
113
113
@@ -144,11 +144,12 @@ def execute_with_realtime_output(command, directory, env=None):
144
144
'outDir' : OW_OUT_DIR }
145
145
146
146
my_env = os .environ .copy ()
147
- my_env ["DISPLAY" ] = ":44"
147
+ DISPLAY = ':44'
148
+ my_env ["DISPLAY" ] = DISPLAY
148
149
149
150
# Xvfb or X virtual framebuffer is a display server implementing the X11 display server protocol.
150
151
# In contrast to other display servers, Xvfb performs all graphical operations in virtual memory without showing any screen output.
151
- os .system ('Xvfb :44 -listen tcp -ac -screen 0 1920x1080x24+32 &' ) # TODO: terminate xvfb after recording
152
+ os .system ('echo Starting xvfb && Xvfb %s -listen tcp -ac -screen 0 1920x1080x24+32 &' % DISPLAY ) # TODO: terminate xvfb after recording
152
153
153
154
try :
154
155
command = """python sibernetic_c302.py
@@ -230,9 +231,11 @@ def execute_with_realtime_output(command, directory, env=None):
230
231
time .sleep (2 )
231
232
232
233
# Rerun and record simulation
233
- os .system ('export DISPLAY=:44' )
234
+ execute_with_realtime_output ('ls -alt /tmp/.X11-unix' , os .environ ['SIBERNETIC_HOME' ], env = my_env )
235
+ os .system ('export DISPLAY=%s' % DISPLAY )
236
+ execute_with_realtime_output ('ls -alt /tmp/.X11-unix' , os .environ ['SIBERNETIC_HOME' ], env = my_env )
234
237
sibernetic_movie_name = '%s.mp4' % os .path .split (latest_subdir )[- 1 ]
235
- command = 'tmux new-session -d -s SiberneticRecording "DISPLAY=:44 ffmpeg -r 30 -f x11grab -draw_mouse 0 -s 1920x1080 -i :44 -filter:v "crop=1200:800:100:100" -cpu-used 0 -b:v 384k -qmin 10 -qmax 42 -maxrate 384k -bufsize 1000k -an %s/%s"' % (new_sim_out , sibernetic_movie_name )
238
+ command = 'tmux new-session -d -P - s SiberneticRecording "DISPLAY=%s ffmpeg -r 30 -f x11grab -draw_mouse 0 -s 1920x1080 -i %s -filter:v "crop=1200:800:100:100" -cpu-used 0 -b:v 384k -qmin 10 -qmax 42 -maxrate 384k -bufsize 1000k -an %s/%s"' % (DISPLAY , DISPLAY , new_sim_out , sibernetic_movie_name )
236
239
execute_with_realtime_output (command , os .environ ['SIBERNETIC_HOME' ], env = my_env )
237
240
238
241
time .sleep (3 )
0 commit comments