mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-22 05:21:09 +00:00
Add a stub backdoor replacement
This commit is contained in:
parent
0570996c36
commit
46edd8a49a
31
confluent_server/confluent/debugger.py
Normal file
31
confluent_server/confluent/debugger.py
Normal file
@ -0,0 +1,31 @@
|
||||
import code
|
||||
import sys
|
||||
|
||||
#this will ultimately fill the role of the 'backdoor' of eventlet
|
||||
|
||||
# since we have to asyncio up the input and output, we use InteractiveInterpreter and handle the
|
||||
# input ourselves, since code is not asyncio friendly in and of itself
|
||||
#code.InteractiveConsole().interact()
|
||||
prompt = '>>> '
|
||||
itr = code.InteractiveInterpreter()
|
||||
while True:
|
||||
sys.stdout.write(prompt)
|
||||
prompt = '... '
|
||||
sys.stdout.flush()
|
||||
newinput = input()
|
||||
somecode += newinput + '\n'
|
||||
if newinput.startswith(' '):
|
||||
prompt = '... '
|
||||
continue
|
||||
try:
|
||||
compcode = code.compile_command(somecode)
|
||||
except SyntaxError as e:
|
||||
print(repr(e))
|
||||
compcode = None
|
||||
somecode = ''
|
||||
prompt = '>>> '
|
||||
if compcode:
|
||||
itr.runcode(compcode)
|
||||
somecode = ''
|
||||
prompt = '>>> '
|
||||
|
Loading…
x
Reference in New Issue
Block a user