pvl.syslog.args: implement --syslog-stdin using pvl.syslog.fifo.Pipe, lets us read from stdin without blocking
--- a/pvl/syslog/args.py Sun Jan 13 02:43:15 2013 +0200
+++ b/pvl/syslog/args.py Sun Jan 13 02:43:38 2013 +0200
@@ -26,6 +26,9 @@
syslog.add_option('--syslog-tail', metavar='FILE',
help="Continuously poll syslog messages given file")
+ syslog.add_option('--syslog-stdin', action='store_true',
+ help="Read syslog messages from stdin")
+
syslog.add_option('--syslog-raw', action='store_true',
help="Parse raw syslog lines without timestamp/etc")
@@ -63,6 +66,11 @@
source = file.File(open(options.syslog_file))
poll = False # do not loop, just read up to EOF
+ elif options.syslog_stdin :
+ # read pipe
+ source = fifo.Pipe.file(sys.stdin) # puts stdin into non-blocking mode
+ poll = True # select(source)
+
elif optional :
return None