Skip to content

Commit

Permalink
Update for //reboot (#1051)
Browse files Browse the repository at this point in the history
* Update for //reboot

This reboots pyplanet after 50 seconds and not kills it. (Windows)

* [Windows] //reboot works now
  • Loading branch information
w1lla committed Aug 30, 2023
1 parent b25774e commit 89bf1cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyplanet/apps/contrib/admin/pyplanet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Player Admin methods and functions.
"""
import os

from pyplanet.contrib.command import Command


Expand All @@ -21,4 +23,9 @@ async def on_start(self):
)

async def reboot_pool(self, player, data, **kwargs):
exit(50)
if os.name == 'nt':
os._exit(50)
os.execl(sys.executable, sys.executable, *sys.argv)
else:
exit(50)

0 comments on commit 89bf1cc

Please sign in to comment.