mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge pull request #1831 from coder2020official/reloader_fix
Update reloader.py
This commit is contained in:
commit
247cddf23d
@ -18,8 +18,14 @@ def restart_file():
|
|||||||
p = psutil.Process(os.getpid())
|
p = psutil.Process(os.getpid())
|
||||||
for handler in p.open_files() + p.connections():
|
for handler in p.open_files() + p.connections():
|
||||||
os.close(handler.fd)
|
os.close(handler.fd)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|
||||||
python = sys.executable
|
python = sys.executable
|
||||||
|
|
||||||
|
if os.name == 'nt':
|
||||||
|
os.execv(sys.executable, ['python'] + sys.argv)
|
||||||
|
else:
|
||||||
os.execl(python, python, *sys.argv)
|
os.execl(python, python, *sys.argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user