()
| 14 | restart_file() |
| 15 | |
| 16 | def restart_file(): |
| 17 | try: |
| 18 | p = psutil.Process(os.getpid()) |
| 19 | for handler in p.open_files() + p.connections(): |
| 20 | os.close(handler.fd) |
| 21 | except OSError: |
| 22 | pass |
| 23 | except Exception as e: |
| 24 | logger.error(e) |
| 25 | |
| 26 | python = sys.executable |
| 27 | |
| 28 | if os.name == 'nt': |
| 29 | os.execv(sys.executable, ['python'] + sys.argv) |
| 30 | else: |
| 31 | os.execl(python, python, *sys.argv) |
no test coverage detected
searching dependent graphs…