| 200 | return self.files |
| 201 | |
| 202 | def call_cmd(self, command, *xargs, **kwargs): |
| 203 | args = [] |
| 204 | |
| 205 | #: Overwrite flag |
| 206 | if self.overwrite: |
| 207 | args.append("-o+") |
| 208 | else: |
| 209 | args.append("-o-") |
| 210 | args.append("-or") |
| 211 | |
| 212 | for word in self.excludefiles: |
| 213 | args.append("-x%s" % word.strip()) |
| 214 | |
| 215 | #: Assume yes on all queries |
| 216 | args.append("-y") |
| 217 | |
| 218 | #: Disable comments show |
| 219 | args.append("-c-") |
| 220 | |
| 221 | #: Set a password |
| 222 | password = kwargs.get('password') |
| 223 | |
| 224 | if password: |
| 225 | args.append("-p%s" % password) |
| 226 | else: |
| 227 | args.append("-p-") |
| 228 | |
| 229 | if self.keepbroken: |
| 230 | args.append("-kb") |
| 231 | |
| 232 | #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue |
| 233 | call = [self.CMD, command] + args + list(xargs) |
| 234 | self.log_debug("EXECUTE " + " ".join(call)) |
| 235 | |
| 236 | call = map(fs_encode, call) |
| 237 | p = Popen( |
| 238 | call, |
| 239 | stdout=subprocess.PIPE, |
| 240 | stderr=subprocess.PIPE) |
| 241 | |
| 242 | renice(p.pid, self.priority) |
| 243 | |
| 244 | return p |