3 # Monkey patch os.spawnve on windows to become thread safe
4 if sys
.platform
== 'win32':
7 from os
import spawnve
as old_spawnve
9 spawn_lock
= threading
.Lock()
11 def new_spawnve(mode
, file, args
, env
):
15 ret
= old_spawnve(os
.P_NOWAIT
, file, args
, env
)
17 ret
= old_spawnve(mode
, file, args
, env
)
21 pid
, status
= os
.waitpid(ret
, 0)
25 os
.spawnve
= new_spawnve