Skip to content

Commit 632c958

Browse files
committed
mt.py: Disable output buffering.
1 parent 4c966d0 commit 632c958

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

python2.7/mt.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
import argparse
44
import multitail
5+
import sys
6+
7+
# http://stackoverflow.com/questions/107705
8+
class Unbuffered(object):
9+
def __init__(self, stream): self.stream = stream
10+
def write(self, data): self.stream.write(data); self.stream.flush()
11+
def __getattr__(self, attr): return getattr(self.stream, attr)
12+
sys.stdout = Unbuffered(sys.stdout)
513

614
parser = argparse.ArgumentParser()
715
parser.add_argument('files', type=str, nargs='+')

0 commit comments

Comments
 (0)