File: filewatch.py

package info (click to toggle)
twisted 12.0.0-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 9,720 kB
  • sloc: python: 78,364; ansic: 179; makefile: 113; sh: 34
file content (17 lines) | stat: -rw-r--r-- 372 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

#
from twisted.application import internet

def watch(fp):
    fp.seek(fp.tell())
    for line in fp.readlines():
        sys.stdout.write(line) 

import sys
from twisted.internet import reactor
s = internet.TimerService(0.1, watch, file(sys.argv[1]))
s.startService()
reactor.run()
s.stopService()