From 1a2eb2da9ec8a9aca495cfb7440768e7d59b8f78 Mon Sep 17 00:00:00 2001 From: dgw Date: Thu, 31 Jan 2019 09:51:49 -0600 Subject: [PATCH] sopel.run: document why Pachuco's cleanup was left out A few commits back, the commit adding the "restart" command originally tried to do some cleanup, too. It was left out of the final version of PR #1333 due to breaking the use of ^C to quit Sopel interactively. These TODO comments will serve as a reminder to eventually figure out why the hell shit broke from something that should be simple, like replacing os._exit() calls (not a great habit) with return values. Something that shouldn't cause any change in function, but somehow did. --- sopel/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sopel/__init__.py b/sopel/__init__.py index bab8a340e1..5e00070e6b 100644 --- a/sopel/__init__.py +++ b/sopel/__init__.py @@ -102,6 +102,11 @@ def signal_handler(sig, frame): logfile.write(trace) logfile.write('----------------------------------------\n\n') logfile.close() + # TODO: This should be handled in run_script + # All we should need here is a return value, but replacing the + # os._exit() call below (at the end) broke ^C. + # This one is much harder to test, so until that one's sorted it + # isn't worth the risk of trying to remove this one. os.unlink(pid_file) os._exit(1) @@ -113,5 +118,8 @@ def signal_handler(sig, frame): break stderr('Warning: Disconnected. Reconnecting in %s seconds...' % delay) time.sleep(delay) + # TODO: This should be handled in run_script + # All we should need here is a return value, but making this + # a return makes Sopel hang on ^C after it says "Closed!" os.unlink(pid_file) os._exit(0)