Reputation: 283
I'm setting up fabric for the first time, and having trouble piping the output from fabric to less. For example, if I run:
fabric deploy |less
(Where deploy is my deployment function)
I get the following error back from fabric:
IOError: [Errno 22] Invalid argument
This comes from a run()
command on the remote host.
If I add pty=False
to the run()
arguments, it works. However, that means every run command, I need to add this argument. Not to mention, I believe it has implications with prompts and entering data (obviously for those cases I won't be piping to less).
How can I fix this? Should I just do tty=false
for everything?
Upvotes: 1
Views: 1204
Reputation: 283
Just for future reference, I resolved this by applying a patch to operations.py, as seen here:
http://code.fabfile.org/attachments/56/operations.patch
Otherwise, the code that would reproduce this problem is as follows:
from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
import re
import sys
def test():
run('ls')
And the issue would come up if you did the following command:
fab -H myhost test |less
Hope this helps someone... I still don't understand why a bug this old still hasn't been patched in the latest release of fabric.
-Dustin
Upvotes: 2