[FIX] shell: now catch SIGINT and raise a regular KeyboardInterrupt

This commit is contained in:
Samus CTO
2014-12-23 12:46:46 +01:00
parent 252757c548
commit ebe42d083b
+4 -2
View File
@@ -22,6 +22,9 @@ import signal
import openerp
from . import Command
def raise_keyboard_interrupt(*a):
raise KeyboardInterrupt()
class Console(code.InteractiveConsole):
def __init__(self, locals=None, filename="<console>"):
code.InteractiveConsole.__init__(self, locals, filename)
@@ -43,10 +46,9 @@ class Shell(Command):
self.locals = {
'openerp': openerp
}
signal.signal(signal.SIGINT, raise_keyboard_interrupt)
def shell(self, dbname):
signal.signal(signal.SIGINT, signal.SIG_DFL)
# TODO: Fix ctrl-c that doesnt seem to generate KeyboardInterrupt
with openerp.api.Environment.manage():
if dbname:
registry = openerp.modules.registry.RegistryManager.get(dbname)