def cleanup():
     log.warning("Cleanup: killing socat process")
     socat.kill()
     if cleanup_hardware:
         try:
             log.warning("Cleanup: removing hardware file %s" %
                         (hardware))
             os.remove(hardware)
         except:
             pass  # possibly a race condition with socat dying and not removing this quickly enough
     if cleanup_software:
         try:
             log.warning("Cleanup: removing software file %s" %
                         (software))
             os.remove(software)
         except:
             pass  # possibly a race condition with socat dying and not removing this quickly enough
     if cleanup_tempdir:
         if os.path.isdir(tempdir):
             log.warning("Cleanup: removing temp directory %s" %
                         (tempdir))
             os.rmdir(tempdir)
     log.warning("Cleanup: done")
 def cleanup():
     log.warning("Cleanup: killing emulator process")
     fork.kill()
     log.warning("Cleanup: done")