Skip to content

Commit e939685

Browse files
committed
fix: exit quickly on keyboard interrupt
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.
1 parent 9f27d74 commit e939685

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Fixed:
5454
argument. Roles are indexed by lower case role name. So 'security
5555
User' and 'security user' should generate the same output. (John
5656
Rouillard from issue on mailing list by Chuck Cunningham)
57+
- make roundup-server exit more quickly on ^C. This seems to be
58+
limited to windows.
5759

5860
Features:
5961

roundup/scripts/roundup_server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,12 @@ def run(port=undefined, success_message=None):
11671167
httpd.serve_forever()
11681168
except KeyboardInterrupt:
11691169
print('Keyboard Interrupt: exiting')
1170+
try:
1171+
httpd.socket.shutdown(socket.SHUT_RDWR)
1172+
except OSError:
1173+
# forced shutdown can throw an error.
1174+
# we don't care as we are going away.
1175+
pass
11701176
httpd.socket.close()
11711177

11721178

0 commit comments

Comments
 (0)