fabric/fabric — pull request #1022 by jphalip (2013-11-16 21:56:12+00:00)
Title: Account for the fact that some file-like objects may not have a isatty() method

This patch is inspired from that of #1019 and addresses a similar issue.

In my case, the issue I'm facing is that the pipe doesn't have an `isatty()` method when running the `fabric.contrib.files.sed` command on an Ubuntu 12.04.3 machine:

```
Traceback (most recent call last):
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/celery/app/trace.py", line 218, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/celery/app/trace.py", line 396, in __protected_call__
return self.run(*args, **kwargs)
File "/vagrant/myproject/myapp/tasks.py", line 35, in mytask
sed('/etc/network/interfaces', old_ip, new_ip, use_sudo=True, )
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/contrib/files.py", line 204, in sed
platform = run("uname")
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/network.py", line 578, in host_prompting_wrapper
return func(*args, **kwargs)
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/operations.py", line 1042, in run
shell_escape=shell_escape)
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/operations.py", line 911, in _run_command
stderr=stderr, timeout=timeout)
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/operations.py", line 737, in _execute
with char_buffered(sys.stdin):
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/context_managers.py", line 432, in char_buffered
if win32 or not pipe.isatty():
AttributeError: '_fileobject' object has no attribute 'isatty'
```