How to run mosh in a python subprocess

196 Views Asked by At

I'm struggling to run mosh effectively within a python subprocess. I can spin up a mosh client and connect to a mosh server, but the process appears to hang.

example ssh command:

ssh -o SendEnv=ENVVAR -l username server_dns_name

example mosh command:

mosh --ssh="ssh -o SendEnv=ENVVAR -l username" server_dns_name

python invocation:

import subprocess

# command = "ssh -o SendEnv=ENVVAR -l username server_dns_name"
command = "mosh --ssh=\"ssh -o SendEnv=ENVVAR -l username\" server_dns_name"

proc = subprocess.run(command, env=os.environ, shell=True)

I expect: normal interaction with mosh.

I get: no way to interact, but a screen presents itself as if I'm connected.

What am I missing?

0

There are 0 best solutions below