Anonymous committed 74dec6b

On FreeBSD, we have to waitpid(pid) twice on process exit
to avoid process zombi

  • Participants
  • Parent commits d9d3391
  • Tags python-ptrace-0.5.0

Comments (0)

Files changed (1)


     from ptrace.binding import ptrace_getregs
     from ptrace.binding import ptrace_peekuser, ptrace_registers_t
-from ptrace.os_tools import HAS_PROC
+from ptrace.os_tools import HAS_PROC, RUNNING_BSD
 from import dumpRegs
 from ptrace.cpu_info import CPU_WORD_SIZE, CPU_64BITS
 from ptrace.ctypes_tools import bytes2word, word2bytes, bytes2type, bytes2array
         self.breakpoints = {} = pid
         self.running = True
+        self.exited = False
         self.parent = parent
         self.was_attached = is_attached
         self.is_attached = False
         return ProcessExit(self)
     def processExited(self, code):
+        if RUNNING_BSD and not self.exited:
+            # on FreeBSD, we have to waitpid() twice
+            # to avoid zombi process!?
+            self.exited = True
+            self.waitExit()
         return ProcessExit(self, exitcode=code)