2
0
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:
Jarrod Johnson 2024-03-15 17:11:12 -04:00
parent 0570996c36
commit 46edd8a49a

View 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 = '>>> '