| 302 | return match.group(1) |
| 303 | |
| 304 | def _p4(self, action, paths): |
| 305 | args = ['p4', '-b', str(len(paths) + 1), '-x', '-', action] |
| 306 | logging.debug(f'Running {" ".join(args)}') |
| 307 | p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 308 | stdout, stderr = p.communicate('\n'.join(paths).encode()) |
| 309 | logging.debug(f'p4 output: stdout: ({stdout.decode()}), stderr: ({stderr.decode()})') |
| 310 | if p.returncode != 0: |
| 311 | logging.error(f'Error when running p4 {action}: {stderr.decode()}') |
| 312 | raise subprocess.CalledProcessError(p.returncode, 'p4', stderr.decode()) |
| 313 | |
| 314 | |
| 315 | def str2bool(v): |