##// END OF EJS Templates
cmdserver: make server streams switchable...
Yuya Nishihara -
r22990:a0e81aa9 default
parent child Browse files
Show More
@@ -126,10 +126,10 b' class channeledinput(object):'
126
126
127 class server(object):
127 class server(object):
128 """
128 """
129 Listens for commands on stdin, runs them and writes the output on a channel
129 Listens for commands on fin, runs them and writes the output on a channel
130 based stream to stdout.
130 based stream to fout.
131 """
131 """
132 def __init__(self, ui, repo):
132 def __init__(self, ui, repo, fin, fout):
133 self.cwd = os.getcwd()
133 self.cwd = os.getcwd()
134
134
135 logpath = ui.config("cmdserver", "log", None)
135 logpath = ui.config("cmdserver", "log", None)
@@ -137,7 +137,7 b' class server(object):'
137 global logfile
137 global logfile
138 if logpath == '-':
138 if logpath == '-':
139 # write log on a special 'd' (debug) channel
139 # write log on a special 'd' (debug) channel
140 logfile = channeledoutput(sys.stdout, 'd')
140 logfile = channeledoutput(fout, 'd')
141 else:
141 else:
142 logfile = open(logpath, 'a')
142 logfile = open(logpath, 'a')
143
143
@@ -151,12 +151,12 b' class server(object):'
151 self.ui = ui
151 self.ui = ui
152 self.repo = self.repoui = None
152 self.repo = self.repoui = None
153
153
154 self.cerr = channeledoutput(sys.stdout, 'e')
154 self.cerr = channeledoutput(fout, 'e')
155 self.cout = channeledoutput(sys.stdout, 'o')
155 self.cout = channeledoutput(fout, 'o')
156 self.cin = channeledinput(sys.stdin, sys.stdout, 'I')
156 self.cin = channeledinput(fin, fout, 'I')
157 self.cresult = channeledoutput(sys.stdout, 'r')
157 self.cresult = channeledoutput(fout, 'r')
158
158
159 self.client = sys.stdin
159 self.client = fin
160
160
161 def _read(self, size):
161 def _read(self, size):
162 if not size:
162 if not size:
@@ -248,7 +248,7 b' class server(object):'
248
248
249 class pipeservice(object):
249 class pipeservice(object):
250 def __init__(self, ui, repo, opts):
250 def __init__(self, ui, repo, opts):
251 self.server = server(ui, repo)
251 self.server = server(ui, repo, sys.stdin, sys.stdout)
252
252
253 def init(self):
253 def init(self):
254 pass
254 pass
General Comments 0
You need to be logged in to leave comments. Login now