1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #584 from gottwald/devel-cowsayUbuntu

Enabled cowsay support for Ubuntu
This commit is contained in:
Michael DeHaan 2012-07-12 05:42:14 -07:00
commit 98eec45525

View file

@ -78,8 +78,16 @@ class AggregateStats(object):
def banner(msg): def banner(msg):
res = "" res = ""
global COWSAY
if os.path.exists("/usr/bin/cowsay"): if os.path.exists("/usr/bin/cowsay"):
cmd = subprocess.Popen("/usr/bin/cowsay -W 60 \"%s\"" % msg, COWSAY = "/usr/bin/cowsay"
elif os.path.exists("/usr/games/cowsay"):
COWSAY = "/usr/games/cowsay"
else:
COWSAY = None
if COWSAY != None:
cmd = subprocess.Popen("%s -W 60 \"%s\"" % (COWSAY, msg),
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
(out, err) = cmd.communicate() (out, err) = cmd.communicate()
res = "%s\n" % out res = "%s\n" % out