Encapsulate Python executable and args in double quotes

If a paths contain spaces, the execv needs quotation marks to not implicitly split those paths into multiple arguments
This commit is contained in:
DukeSniper 2024-04-28 00:10:01 +02:00
parent ade3dee5c6
commit 066e00bd5e

View File

@ -1081,7 +1081,10 @@ def restart(self):
exit(0) exit(0)
print(f"\nRestarting... [Legacy Mode]\n\n") print(f"\nRestarting... [Legacy Mode]\n\n")
return os.execv(sys.executable, [sys.executable] + sys.argv) if sys.platform.startswith('win32'):
return os.execv(sys.executable, ['"' + sys.executable + '"', '"' + sys.argv[0] + '"'] + sys.argv[1:])
else:
return os.execv(sys.executable, [sys.executable] + sys.argv)
def sanitize_filename(input_string): def sanitize_filename(input_string):