def call_cmd(self, command, *xargs, **kwargs): args = [] #: Overwrite flag if self.overwrite: args.append("-o+") else: args.append("-o-") args.append("-or") for word in self.excludefiles: args.append("-x'%s'" % word.strip()) #: Assume yes on all queries args.append("-y") #: Set a password if kwargs.get('password'): args.append("-p%s" % kwargs['password']) else: args.append("-p-") if self.keepbroken: args.append("-kb") #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) self.log_debug(" ".join(call)) p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) renice(p.pid, self.priority) return p
def call_cmd(self, command, *xargs, **kwargs): args = [] #: Overwrite flag if self.overwrite: args.append("-y") #: Set a password if kwargs.get('password'): args.append("-p%s" % kwargs['password']) else: args.append("-p-") #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) self.log_debug(" ".join(call)) p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) renice(p.pid, self.priority) return p