From e0c6fdc720de9ffed2f01687ad65c84760a8bdd5 Mon Sep 17 00:00:00 2001 From: Artem30801 Date: Tue, 25 Feb 2020 16:32:43 +0300 Subject: [PATCH] Added restart to client for testing --- Drone/client.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Drone/client.py b/Drone/client.py index ff293c2..16de4ed 100644 --- a/Drone/client.py +++ b/Drone/client.py @@ -238,7 +238,20 @@ def _response_time(*args, **kwargs): if __name__ == "__main__": + startup_cwd = os.getcwd() + import threading + + + def restart(): # move to core + args = sys.argv[:] + logging.info('Restarting {}'.format(args)) + args.insert(0, sys.executable) + if sys.platform == 'win32': + args = ['"%s"' % arg for arg in args] + os.chdir(startup_cwd) + os.execv(sys.executable, args) + def mock_telem(): while True: time.sleep(5)