##// END OF EJS Templates
cmdserver: use given streams as pipe channels like other commands...
Yuya Nishihara -
r23322:000cfc8b default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from i18n import _
8 from i18n import _
9 import struct
9 import struct
10 import sys, os, errno, traceback, SocketServer
10 import os, errno, traceback, SocketServer
11 import dispatch, encoding, util
11 import dispatch, encoding, util
12
12
13 logfile = None
13 logfile = None
@@ -250,7 +250,7 b' class server(object):'
250
250
251 class pipeservice(object):
251 class pipeservice(object):
252 def __init__(self, ui, repo, opts):
252 def __init__(self, ui, repo, opts):
253 self.server = server(ui, repo, sys.stdin, sys.stdout)
253 self.server = server(ui, repo, ui.fin, ui.fout)
254
254
255 def init(self):
255 def init(self):
256 pass
256 pass
@@ -524,6 +524,27 b' check that local configs for the cached '
524 prompt: 5678
524 prompt: 5678
525
525
526
526
527 run commandserver in commandserver, which is silly but should work:
528
529 >>> import cStringIO
530 >>> from hgclient import readchannel, runcommand, check
531 >>> @check
532 ... def nested(server):
533 ... print '%c, %r' % readchannel(server)
534 ... class nestedserver(object):
535 ... stdin = cStringIO.StringIO('getencoding\n')
536 ... stdout = cStringIO.StringIO()
537 ... runcommand(server, ['serve', '--cmdserver', 'pipe'],
538 ... output=nestedserver.stdout, input=nestedserver.stdin)
539 ... nestedserver.stdout.seek(0)
540 ... print '%c, %r' % readchannel(nestedserver) # hello
541 ... print '%c, %r' % readchannel(nestedserver) # getencoding
542 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
543 *** runcommand serve --cmdserver pipe
544 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
545 r, '*' (glob)
546
547
527 start without repository:
548 start without repository:
528
549
529 $ cd ..
550 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now