From 5fbaa089898951b3eb828cce10ed38c1cb65c24c Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 18 Oct 2016 20:35:46 +0200 Subject: [PATCH] [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. --- bin/linux/restart.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/linux/restart.py b/bin/linux/restart.py index 96397f82b946..5633f1289aff 100755 --- a/bin/linux/restart.py +++ b/bin/linux/restart.py @@ -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 [optional command]') +signal.signal(signal.SIGHUP, signal.SIG_IGN) + pid = int(sys.argv[1]) while os.getppid() == pid: time.sleep(0.5)