mainloop: Only delete pid watch if we found the right pid
This commit is contained in:
parent
abfe17e2cb
commit
16f2f5f7e5
|
|
@ -69,9 +69,9 @@ class Mainloop(object):
|
||||||
to_delete_pids = []
|
to_delete_pids = []
|
||||||
for pid in self._pid_watches:
|
for pid in self._pid_watches:
|
||||||
(opid, status) = os.waitpid(pid, os.WNOHANG)
|
(opid, status) = os.waitpid(pid, os.WNOHANG)
|
||||||
if opid != 0:
|
if opid == pid:
|
||||||
to_delete_pids.append(pid)
|
to_delete_pids.append(pid)
|
||||||
self._pid_watches[pid](opid, status)
|
self._pid_watches[pid](pid, status)
|
||||||
for pid in to_delete_pids:
|
for pid in to_delete_pids:
|
||||||
del self._pid_watches[pid]
|
del self._pid_watches[pid]
|
||||||
newtime = time.time() * 1000
|
newtime = time.time() * 1000
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue