Skip to content

Commit

Permalink
fix: exit quickly on keyboard interrupt
Browse files Browse the repository at this point in the history
When exiting roundup_server (issue was seen in use of roundup_demo)
using ^C, the keyboard interrupt message is generated but the
application didn't exit until the 60 second socket timeout is
complete.

This seems to be more of an issue with Windows.

With this change the socket is explicitly shut down telling the client
what's happening. Then the file descriptor is closed.
  • Loading branch information
rouilj committed Oct 7, 2023
1 parent 9f27d74 commit e939685
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Fixed:
argument. Roles are indexed by lower case role name. So 'security
User' and 'security user' should generate the same output. (John
Rouillard from issue on mailing list by Chuck Cunningham)
- make roundup-server exit more quickly on ^C. This seems to be
limited to windows.

Features:

Expand Down
6 changes: 6 additions & 0 deletions roundup/scripts/roundup_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,12 @@ def run(port=undefined, success_message=None):
httpd.serve_forever()
except KeyboardInterrupt:
print('Keyboard Interrupt: exiting')
try:
httpd.socket.shutdown(socket.SHUT_RDWR)
except OSError:
# forced shutdown can throw an error.
# we don't care as we are going away.
pass
httpd.socket.close()


Expand Down

0 comments on commit e939685

Please sign in to comment.