Show More
@@ -237,10 +237,10 static void handlesystemrequest(hgclient | |||
|
237 | 237 | ctx->data[ctx->datasize] = '\0'; /* terminate last string */ |
|
238 | 238 | |
|
239 | 239 | const char **args = unpackcmdargsnul(ctx); |
|
240 | if (!args[0] || !args[1]) | |
|
241 | abortmsg("missing command or cwd in system request"); | |
|
242 |
debugmsg("run '%s' at '%s'", args[ |
|
|
243 |
int32_t r = runshellcmd(args[ |
|
|
240 | if (!args[0] || !args[1] || !args[2]) | |
|
241 | abortmsg("missing type or command or cwd in system request"); | |
|
242 | debugmsg("run '%s' at '%s'", args[1], args[2]); | |
|
243 | int32_t r = runshellcmd(args[1], args + 3, args[2]); | |
|
244 | 244 | free(args); |
|
245 | 245 | |
|
246 | 246 | uint32_t r_n = htonl(r); |
@@ -287,13 +287,14 class channeledsystem(object): | |||
|
287 | 287 | """Propagate ui.system() request in the following format: |
|
288 | 288 | |
|
289 | 289 | payload length (unsigned int), |
|
290 | type, '\0', | |
|
290 | 291 | cmd, '\0', |
|
291 | 292 | cwd, '\0', |
|
292 | 293 | envkey, '=', val, '\0', |
|
293 | 294 | ... |
|
294 | 295 | envkey, '=', val |
|
295 | 296 | |
|
296 | and waits: | |
|
297 | if type == 'system', waits for: | |
|
297 | 298 | |
|
298 | 299 | exitcode length (unsigned int), |
|
299 | 300 | exitcode (int) |
@@ -303,8 +304,8 class channeledsystem(object): | |||
|
303 | 304 | self.out = out |
|
304 | 305 | self.channel = channel |
|
305 | 306 | |
|
306 | def __call__(self, cmd, environ, cwd): | |
|
307 | args = [util.quotecommand(cmd), os.path.abspath(cwd or '.')] | |
|
307 | def __call__(self, cmd, environ, cwd, type='system'): | |
|
308 | args = [type, util.quotecommand(cmd), os.path.abspath(cwd or '.')] | |
|
308 | 309 | args.extend('%s=%s' % (k, v) for k, v in environ.iteritems()) |
|
309 | 310 | data = '\0'.join(args) |
|
310 | 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