mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user