From c61c330e6d0f69b13864870b8cb90957d5e4ef55 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 27 Jun 2015 08:38:28 +0530 Subject: [PATCH] ... --- src/calibre/utils/rapydscript.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/utils/rapydscript.py b/src/calibre/utils/rapydscript.py index 9958095f40..1074d548f7 100644 --- a/src/calibre/utils/rapydscript.py +++ b/src/calibre/utils/rapydscript.py @@ -249,27 +249,29 @@ class Repl(Thread): rl = { setPrompt:set_prompt, write:Duktape.write, - clearLine:function() {}, + clearLine: function() {}, on: function(ev, cb) { listeners[ev] = cb; return rl; }, prompt: prompt, sync_prompt: true, send_line: function(line) { listeners['line'](line); }, send_interrupt: function() { listeners['SIGINT'](); }, - close: function() {listeners['close'](); } + close: function() {listeners['close'](); }, }; ''') rl = self.ctx.g.rl self.ctx.eval('module.exports(repl_options)') completer = to_python(rl.completer) + send_interrupt = to_python(rl.send_interrupt) + send_line = to_python(rl.send_line) while True: ev, line = self.to_repl.get() try: if ev == 'SIGINT': self.output.write('\n') - rl.send_interrupt() + send_interrupt() elif ev == 'line': - rl.send_line(line) + send_line(line) else: val = completer(line) val = to_python(val)