Python Fabric: executing interactive program such as less on remote?

203 views Asked by At

When I execute something like:

run('less <somefile>')

Within fabric, it prepends the lines with Out: and interacting with it doesn't work as expected.

If I run it with:

run('cat <something>', pty=False)

The output isn't prepended with anything and I can actually pipe that into less locally, like:

fab less | less

However I'm not sure if that's recommended since I feel it may be taxing on the remote resource since cat will continually be piping back through ssh. Also when I quick less before the whole file is cat'd (it could be over 1GB), I get a broker pipe error.

What would be the recommended way to facilitate this? Should I just use ssh directly like:

ssh <remote host> less <something>
1

There are 1 answers

0
ronnix On

If you're doing interactive work on the remote host, then maybe just using SSH is fine. I think fabric is mostly useful when automating actions.