##// END OF EJS Templates
chg: send type information via S channel (BC)...
Jun Wu -
r30726:dd897eb1 default
parent child Browse files
Show More
@@ -237,10 +237,10 b' static void handlesystemrequest(hgclient'
237 ctx->data[ctx->datasize] = '\0'; /* terminate last string */
237 ctx->data[ctx->datasize] = '\0'; /* terminate last string */
238
238
239 const char **args = unpackcmdargsnul(ctx);
239 const char **args = unpackcmdargsnul(ctx);
240 if (!args[0] || !args[1])
240 if (!args[0] || !args[1] || !args[2])
241 abortmsg("missing command or cwd in system request");
241 abortmsg("missing type or command or cwd in system request");
242 debugmsg("run '%s' at '%s'", args[0], args[1]);
242 debugmsg("run '%s' at '%s'", args[1], args[2]);
243 int32_t r = runshellcmd(args[0], args + 2, args[1]);
243 int32_t r = runshellcmd(args[1], args + 3, args[2]);
244 free(args);
244 free(args);
245
245
246 uint32_t r_n = htonl(r);
246 uint32_t r_n = htonl(r);
@@ -287,13 +287,14 b' class channeledsystem(object):'
287 """Propagate ui.system() request in the following format:
287 """Propagate ui.system() request in the following format:
288
288
289 payload length (unsigned int),
289 payload length (unsigned int),
290 type, '\0',
290 cmd, '\0',
291 cmd, '\0',
291 cwd, '\0',
292 cwd, '\0',
292 envkey, '=', val, '\0',
293 envkey, '=', val, '\0',
293 ...
294 ...
294 envkey, '=', val
295 envkey, '=', val
295
296
296 and waits:
297 if type == 'system', waits for:
297
298
298 exitcode length (unsigned int),
299 exitcode length (unsigned int),
299 exitcode (int)
300 exitcode (int)
@@ -303,8 +304,8 b' class channeledsystem(object):'
303 self.out = out
304 self.out = out
304 self.channel = channel
305 self.channel = channel
305
306
306 def __call__(self, cmd, environ, cwd):
307 def __call__(self, cmd, environ, cwd, type='system'):
307 args = [util.quotecommand(cmd), os.path.abspath(cwd or '.')]
308 args = [type, util.quotecommand(cmd), os.path.abspath(cwd or '.')]
308 args.extend('%s=%s' % (k, v) for k, v in environ.iteritems())
309 args.extend('%s=%s' % (k, v) for k, v in environ.iteritems())
309 data = '\0'.join(args)
310 data = '\0'.join(args)
310 self.out.write(struct.pack('>cI', self.channel, len(data)))
311 self.out.write(struct.pack('>cI', self.channel, len(data)))
General Comments 0
You need to be logged in to leave comments. Login now