Skip to content

Commit

Permalink
__main__: Restart on exit code 96
Browse files Browse the repository at this point in the history
  • Loading branch information
irgolic committed Nov 4, 2020
1 parent aa9eb7c commit a71c2af
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Orange/canvas/__main__.py
Expand Up @@ -23,6 +23,7 @@
import json
from urllib.request import urlopen, Request
import pkg_resources
import psutil
import requests
from unittest.mock import patch

Expand Down Expand Up @@ -722,6 +723,17 @@ def show_message(message):
gc.collect()

del app

if status == 96:
log.info('Restarting via exit code 96.')
try:
p = psutil.Process(os.getpid())
for handler in p.open_files() + p.connections():
os.close(handler.fd)
except Exception as e: # pylint: disable=broad-except
logging.error(e)
return os.execv(sys.executable, ['python', sys.argv[0]])

return status


Expand Down

0 comments on commit a71c2af

Please sign in to comment.