Skip to content

Commit

Permalink
sopel.run: document why Pachuco's cleanup was left out
Browse files Browse the repository at this point in the history
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 sopel-irc#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.
  • Loading branch information
dgw authored and kwaaak committed Mar 25, 2019
1 parent 9294891 commit 1a2eb2d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sopel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

0 comments on commit 1a2eb2d

Please sign in to comment.