mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Do not assume that stdin is a tty
This can be used from another non interactive software, see #9695 for details.
This commit is contained in:
parent
12968acd5f
commit
f7ac012301
1 changed files with 4 additions and 1 deletions
|
@ -165,7 +165,10 @@ def get_snippet_text(doc):
|
||||||
return "\n".join(text)
|
return "\n".join(text)
|
||||||
|
|
||||||
def get_module_list_text(module_list):
|
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)
|
displace = max(len(x) for x in module_list)
|
||||||
linelimit = columns - displace - 5
|
linelimit = columns - displace - 5
|
||||||
text = []
|
text = []
|
||||||
|
|
Loading…
Reference in a new issue