File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,12 @@ def create_xvfb_cmd():
154
154
The second List contains a read and a write descriptor.
155
155
The first List is the command to launch Xvfb process with the same write descriptor(from the first list) embedded in the command.
156
156
"""
157
- dpipe = os .pipe ()
157
+ # Using os.pipe() can lead to race conditions (ie.usage of same set of file descriptors between 2 processes)
158
+ # when called in quick succession and also when running tests.
159
+ # Using os.pipe2() with the flag os.O_NONBLOCK will avoid race conditions.
160
+ dpipe = os .pipe2 (os .O_NONBLOCK )
161
+
162
+ # Allow child process to use the file descriptor created by parent.
158
163
os .set_inheritable (dpipe [1 ], True )
159
164
160
165
xvfb_cmd = [
You can’t perform that action at this time.
0 commit comments