Skip to content

Commit

Permalink
[FIX] server.py traceback on ctrl-c from windows cmd
Browse files Browse the repository at this point in the history
Define a shim signal.SIGHUP on windows to avoid an ifdef in the threaded server
loop.
  • Loading branch information
antonylesuisse committed Nov 18, 2014
1 parent 7999965 commit aa9eec3
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions openerp/service/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
import platform
import psutil
import random
if os.name == 'posix':
import resource
else:
resource = None
import select
import signal
import socket
Expand All @@ -24,10 +20,15 @@

import werkzeug.serving

try:
if os.name == 'posix':
# Unix only for workers
import fcntl
except ImportError:
pass
import resource
else:
# Windows shim
signal.SIGHUP = 0

# Optional process names for workers
try:
from setproctitle import setproctitle
except ImportError:
Expand Down Expand Up @@ -674,8 +675,6 @@ def sleep(self):
raise

def process_limit(self):
if resource is None:
return
# If our parent changed sucide
if self.ppid != os.getppid():
_logger.info("Worker (%s) Parent changed", self.pid)
Expand Down

0 comments on commit aa9eec3

Please sign in to comment.