OLD | NEW |
| (Empty) |
1 # -*- test-case-name: twisted.test.test_stdio.StandardInputOutputTestCase.test_w
rite -*- | |
2 # Copyright (c) 2006-2007 Twisted Matrix Laboratories. | |
3 # See LICENSE for details. | |
4 | |
5 """ | |
6 Main program for the child process run by | |
7 L{twisted.test.test_stdio.StandardInputOutputTestCase.test_write} to test that | |
8 ITransport.write() works for process transports. | |
9 """ | |
10 | |
11 import sys | |
12 | |
13 from twisted.internet import stdio, protocol | |
14 from twisted.python import reflect | |
15 | |
16 class WriteChild(protocol.Protocol): | |
17 def connectionMade(self): | |
18 for ch in 'ok!': | |
19 self.transport.write(ch) | |
20 self.transport.loseConnection() | |
21 | |
22 | |
23 def connectionLost(self, reason): | |
24 reactor.stop() | |
25 | |
26 | |
27 if __name__ == '__main__': | |
28 reflect.namedAny(sys.argv[1]).install() | |
29 from twisted.internet import reactor | |
30 stdio.StandardIO(WriteChild()) | |
31 reactor.run() | |
32 | |
OLD | NEW |