summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichael Scherer <misc@zarb.org>2014-12-14 17:56:18 +0100
committerMichael Scherer <misc@zarb.org>2014-12-14 17:56:18 +0100
commitf7ac0123011a21ce8282fb5450a3799572f15a14 (patch)
treefb6b15ee38ac9653918d39c9342c0e9f76d78f8c /bin
parent12968acd5f553d1b0b46eb2111443e223a7f2e93 (diff)
downloadansible-f7ac0123011a21ce8282fb5450a3799572f15a14.tar.gz
Do not assume that stdin is a tty
This can be used from another non interactive software, see #9695 for details.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ansible-doc5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ansible-doc b/bin/ansible-doc
index 0ba84b9a30..59d14b6ef1 100755
--- a/bin/ansible-doc
+++ b/bin/ansible-doc
@@ -165,7 +165,10 @@ def get_snippet_text(doc):
return "\n".join(text)
def get_module_list_text(module_list):
- columns = max(60, int(os.popen('stty size', 'r').read().split()[1]))
+ tty_size = 0
+ if os.isatty(0):
+ tty_size = int(os.popen('stty size', 'r').read().split()[1])
+ columns = max(60, tty_size)
displace = max(len(x) for x in module_list)
linelimit = columns - displace - 5
text = []