| 158 | return self.files |
| 159 | |
| 160 | def call_cmd(self, command, *xargs, **kwargs): |
| 161 | args = [] |
| 162 | |
| 163 | if self.VERSION and float(self.VERSION) >= 15.08: |
| 164 | #: Disable all output except progress and errors |
| 165 | args.append("-bso0") |
| 166 | args.append("-bsp1") |
| 167 | |
| 168 | #: Overwrite flag |
| 169 | if self.overwrite: |
| 170 | if self.VERSION and float(self.VERSION) >= 15.08: |
| 171 | args.append("-aoa") |
| 172 | |
| 173 | else: |
| 174 | args.append("-y") |
| 175 | |
| 176 | else: |
| 177 | if self.VERSION and float(self.VERSION) >= 15.08: |
| 178 | args.append("-aos") |
| 179 | |
| 180 | #: Exclude files |
| 181 | for word in self.excludefiles: |
| 182 | args.append("-xr!%s" % word.strip()) |
| 183 | |
| 184 | #: Set a password |
| 185 | password = kwargs.get('password') |
| 186 | |
| 187 | if password: |
| 188 | args.append("-p%s" % password) |
| 189 | else: |
| 190 | args.append("-p-") |
| 191 | |
| 192 | #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue |
| 193 | call = [self.CMD, command] + args + list(xargs) |
| 194 | self.log_debug("EXECUTE " + " ".join(call)) |
| 195 | |
| 196 | call = map(fs_encode, call) |
| 197 | p = Popen( |
| 198 | call, |
| 199 | stdout=subprocess.PIPE, |
| 200 | stderr=subprocess.PIPE) |
| 201 | |
| 202 | renice(p.pid, self.priority) |
| 203 | |
| 204 | return p |