create pipe idler
[uccvend-vendserver.git] / sql-edition / servers / Idler.py
index 5fe61cf..2670b51 100755 (executable)
@@ -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...."

UCC git Repository :: git.ucc.asn.au