[platform] ignore SIGHUP in restarter script (IDEA-162263)

When the IDE is launched in it's own terminal (File Manager | Run in Terminal), shutting it down kills the restarter script as well. Ignoring the signal allows the script to outlive a terminal and successfully restart the IDE.
This commit is contained in:
Roman Shevchenko
2016-10-18 20:35:46 +02:00
parent 5cb324e90a
commit 5fbaa08989
+3
View File
@@ -3,12 +3,15 @@
# Waits for the parent process to terminate, then executes specified commands.
import os
import signal
import sys
import time
if len(sys.argv) < 3:
raise Exception('usage: restart.py <pid> <path> [optional command]')
signal.signal(signal.SIGHUP, signal.SIG_IGN)
pid = int(sys.argv[1])
while os.getppid() == pid:
time.sleep(0.5)