Commit d703c5bc authored by Matias Guijarro's avatar Matias Guijarro
Browse files

fix

parent 9068a548
Pipeline #55049 failed with stages
in 114 minutes and 30 seconds
......@@ -244,8 +244,6 @@ class BlissServerRepl(BlissRepl):
sys.stdout
) # keep a reference to the stdout at the moment this object is created, it is not yet the patched one for ptpython
self._term_rows, self._term_cols = kwargs.pop("term_size", DEFAULT_TERM_SIZE)
self._task = None
# PipeInput object, for sending input in the CLI.
# (This is something that we can use in the prompt_toolkit event loop,
# but still write date in manually.)
......@@ -280,9 +278,9 @@ class BlissServerRepl(BlissRepl):
def send_ctrl_c(self):
try:
if self._current_app is self.app and self._task:
sys.__stdout__.write(f"KILLING TASK={repr(self._task)}\n")
self._task.kill(KeyboardInterrupt)
if self._current_app is self.app and self._current_eval_g:
sys.__stdout__.write(f"KILLING TASK={repr(self._current_eval_g)}\n")
self._current_eval_g.kill(KeyboardInterrupt)
except BaseException as e:
sys.__stdout__.write(f"EXC {e}\n")
......@@ -293,24 +291,6 @@ class BlissServerRepl(BlissRepl):
except BaseException as e:
sys.__stdout__.write(f"EXC {e}\n")
def _do_eval(self, async_future, text):
try:
result = self.eval(text)
except BaseException as exc:
async_future.set_exception(exc)
else:
async_future.set_result(result)
def eval_async(self, text):
# nice trick with the asyncio future taken from "wrap_greenlet" in aiogevent
# (only code that works that allows to execute gevent code while being able to
# process CTRL-C... !)
fut = asyncio.Future()
self._task = gevent.spawn(self._do_eval, fut, text)
return fut
def _get_size(self) -> Size:
"""
Callable that returns the current `Size`, required by Vt100_Output.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment