def cleanup(self):
"""Close and remove all created temporary files.
For the purposes of debugging, files are not removed
if BAP finished with a positive nonzero code. I.e.,
they are removed only if BAP terminated normally, or was
killed by a signal (terminated).
All opened file descriptros are closed in any case."""
for desc in self.fds:
desc.close()
if not self.DEBUG and (self.proc is None or
self.proc.returncode <= 0):
for path in os.listdir(self.tmpdir):
os.remove(os.path.join(self.tmpdir, path))
os.rmdir(self.tmpdir)
评论列表
文章目录