equal
deleted
inserted
replaced
52 return '<%c-channel>' % self.channel |
52 return '<%c-channel>' % self.channel |
53 |
53 |
54 def write(self, data): |
54 def write(self, data): |
55 if not data: |
55 if not data: |
56 return |
56 return |
57 self.out.write(struct.pack('>cI', self.channel, len(data))) |
57 # single write() to guarantee the same atomicity as the underlying file |
58 self.out.write(data) |
58 self.out.write(struct.pack('>cI', self.channel, len(data)) + data) |
59 self.out.flush() |
59 self.out.flush() |
60 |
60 |
61 def __getattr__(self, attr): |
61 def __getattr__(self, attr): |
62 if attr in ('isatty', 'fileno', 'tell', 'seek'): |
62 if attr in ('isatty', 'fileno', 'tell', 'seek'): |
63 raise AttributeError(attr) |
63 raise AttributeError(attr) |