From 8c91f790250d69e2787329f54182d8d56fe2e67d Mon Sep 17 00:00:00 2001 From: Bernard Blackham Date: Sun, 12 Dec 2004 06:51:06 +0000 Subject: [PATCH] create pipe idler --- sql-edition/servers/Idler.py | 13 +++++++++++++ sql-edition/servers/VendServer.py | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sql-edition/servers/Idler.py b/sql-edition/servers/Idler.py index 5fe61cf..2670b51 100755 --- a/sql-edition/servers/Idler.py +++ b/sql-edition/servers/Idler.py @@ -247,6 +247,19 @@ class FortuneIdler(StringIdler): def affinity(self): return 20 +class PipeIdler(StringIdler): + def __init__(self, v, command): + text = "I ate my cookie...." + if os.access(command,os.F_OK|os.X_OK): + (stdout, stdin) = popen2.popen2(command) + text = string.join(stdout.readlines()) + stdout.close() + stdin.close() + StringIdler.__init__(self, v, text,repeat=False) + + def affinity(self): + return 20 + class FileIdler(StringIdler): def __init__(self, v, thefile=None, repeat=False): text = "I broke my wookie...." diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index d6f48c9..93f22f2 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -205,7 +205,8 @@ def setup_idlers(v): GrayIdler(v,one="/",zero="\\",reorder=1), StringIdler(v, text=str(math.e) + " "), GrayIdler(v,one="X",zero="O",reorder=1), - StringIdler(v, text="I want some pizza - please call Pizza Hut Shenton Park on +61 8 9381 9979 - and order as Quinn - I am getting really hungry", repeat=False), + StringIdler(v, text=" I want some pizza - please call Pizza Hut Shenton Park on +61 8 9381 9979 - and order as Quinn - I am getting really hungry", repeat=False), + PipeIdler(v, "/usr/bin/ypcat", "passwd"), FortuneIdler(v), ClockIdler(v), StringIdler(v), -- 2.20.1