I've created a long-running application that has a memory leak in it. Rather than spend time on finding & fixing a complex bug in an even more complex program, I've written a bit of code to restart the application in case a memory error occurs:
'''Launches another instance of RAGE, then quits this application.'''
new_rage = subprocess.Popen([sys.executable] + sys.argv,
# Give the new process time to start before we close.
# If we quit too quickly the new process won't start either.
self.log.error('Unable to start a new RAGE instance. Just quitting.')
# This is expected.
This works just fine, except that PyCharm (correctly) assumes the program has stopped. It then no longer logs the output of the new program instance, so that program's stdout/err are nowhere to be seen.
Is there a way in which I can close the current process and start a new one, while keeping PyCharm attached to the new process?
Thanks in advance for any help,