Skip to content

Commit

Permalink
Fix handling Ctrl-C (and signals) with Jython and IronPython
Browse files Browse the repository at this point in the history
Fixes #14. The fix doesn't work with Jython on Windows, though.
  • Loading branch information
pekkaklarck committed Mar 5, 2014
1 parent c0e8e53 commit dc33a0e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/robotremoteserver.py
Original file line number Diff line number Diff line change
@@ -62,7 +62,6 @@ def _register_signal_handlers(self):
def stop_with_signal(signum, frame):
self._allow_stop = True
self.stop_remote_server()
raise KeyboardInterrupt
for name in 'SIGINT', 'SIGTERM', 'SIGHUP':
if hasattr(signal, name):
signal.signal(getattr(signal, name), stop_with_signal)
@@ -79,11 +78,12 @@ def _announce_start(self, port_file=None):
pf.close()

def serve_forever(self):
try:
while not self._shutdown:
self.handle_request()
except KeyboardInterrupt:
pass
if hasattr(self, 'timeout'):
self.timeout = 0.5
else:
self.socket.settimeout(0.5)
while not self._shutdown:
self.handle_request()

def stop_remote_server(self):
prefix = 'Robot Framework remote server at %s:%s ' % self.server_address

0 comments on commit dc33a0e

Please sign in to comment.