This commit is contained in:
Kovid Goyal 2015-06-27 08:38:28 +05:30
parent 8b777eb1d4
commit c61c330e6d

View File

@ -255,21 +255,23 @@ class Repl(Thread):
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)