Skip to content

Commit

Permalink
Update SerialCord
Browse files Browse the repository at this point in the history
  • Loading branch information
PSzczepanski1996 committed Jan 28, 2024
1 parent be620d9 commit 8bcf220
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions misc/SerialCord/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def __init__(self, **options):
)
tree = app_commands.CommandTree(client)
config = read_json_file('config.json')
kenOS = pexpect.spawn('qemu-system-i386 -serial stdio -drive file=../../kenos.iso,index=0,media=disk,format=raw')
kenOS = pexpect.spawn(
'qemu-system-i386 -serial stdio -drive file=../../kenos.iso,index=0,media=disk,format=raw',
)
kenOS.logfile_read = sys.stdout.buffer


Expand All @@ -40,7 +42,7 @@ async def on_ready():
@tree.command(description='Kenify input to SerialCord')
async def kenify(interaction, msg: str):
kenOS.sendline(msg[:8])
kenOS.expect(r'KenOutput: {(.*?)}')
kenOS.expect([pexpect.TIMEOUT, r'KenOutput: {(.*?)}', pexpect.EOF])
response = kenOS.match
await interaction.response.send_message(
response.group(1).decode('utf-8'),
Expand Down

0 comments on commit 8bcf220

Please sign in to comment.