如何在下面的代码中避免创建僵尸进程。
for i, (incident, host_name) in enumerate(slm_incidents.limit(10)):
try:
subprocess.Popen(['python2.7', "cli.py", '--host', str(host_name), '--incidentID', str(incident.id)],
env=self.my_env, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
except:
exc_info = sys.exc_info()
traceback.print_exception(*exc_info)
log(self.log_file, 'Issue: ')
log(self.log_file, traceback.format_exc())
log(self.log_file, 'Integration getting error in {} process.'.format(i))
self.fail_excecution += 1
sleep(30)