I am writing a small test script that exercises asyncssh facilities. One of the test scenarios is running ping localhost
process and then sending CTRL+\
to report intermediary summary. However I have been unsuccessful sending ASCII control codes. Here is some test code:
async def test_control_code():
async with asyncssh.connect(host='localhost', username='user', password='userpw', known_hosts=None) as conn:
async with conn.create_process('ping localhost') as proc:
proc._stdin.write(b'\x1c') # Error, says can't send in bytes
if __name__ == '__main__':
asyncio.run(test_control_code())
How can I send CTRL + \
to the running process using asyncssh?