Skip to content

Possible pty detection bug #303

Description

@bitprophet

Description

IRC user djill_ encounters problems in 1.0 (but not 0.9) when piping Fabric output to tee, e.g. fab [options] [task names] | tee [filename].

This is his traceback:

09:32 < djill_>   File "/usr/lib/python2.5/site-packages/Fabric-1.0.0-py2.5.egg/fabric/main.py", line 537, in main
09:32 < djill_>     commands[name](*args, **kwargs)
09:32 < djill_>   File "/home/fabric/fabsys.py", line 15, in date
09:32 < djill_>     run('date')
09:32 < djill_>   File "/usr/lib/python2.5/site-packages/Fabric-1.0.0-py2.5.egg/fabric/network.py", line 304, in host_prompting_wrapper
09:32 < djill_>     return func(*args, **kwargs)
09:32 < djill_>   File "/usr/lib/python2.5/site-packages/Fabric-1.0.0-py2.5.egg/fabric/operations.py", line 916, in run
09:32 < djill_>     return _run_command(command, shell, pty, combine_stderr)
09:32 < djill_>   File "/usr/lib/python2.5/site-packages/Fabric-1.0.0-py2.5.egg/fabric/operations.py", line 840, in _run_command
09:32 < djill_>     combine_stderr)
09:32 < djill_>   File "/usr/lib/python2.5/site-packages/Fabric-1.0.0-py2.5.egg/fabric/operations.py", line 726, in _execute
09:32 < djill_>     rows, cols = _pty_size()
09:32 < djill_>   File "/usr/lib/python2.5/site-packages/Fabric-1.0.0-py2.5.egg/fabric/operations.py", line 50, in _pty_size
09:32 < djill_>     buffer)
09:32 < djill_> IOError: [Errno 22] Invalid argument

That says to me that it's a bug in how we try to update the remote pty based on the local one; if one's stdout/stderr is going to a shell pipe and not a terminal, that could definitely be causing that IOError.

Hopefully a quick fix; though given that it's an IOError with "invalid argument" (which is kind of generic) we may need to find a way of testing beforehand and skipping the pty stuff, instead of simply adding a try/catch.

EDIT: Michael Bravo has a similar/same issue when piping Fabric to grep, though his error was IOError: [Errno 25] Inappropriate ioctl for device (on the exact same line). Not sure if that's an argument for or against the test-first vs catch-IOErrors approach...


Originally submitted by Jeff Forcier (bitprophet) on 2011-03-07 at 10:25am EST

Attachments

Relations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions