Run a shell command safely via subprocess (no shell=True). Args: *args: Command and its arguments as separate strings, e.g. ``self.run_cmd('docker', 'build', '-t', tag, '.')``. Returns: The process return code (0 on success).
(self, *args: str)
| 71 | f.write(content) |
| 72 | |
| 73 | def run_cmd(self, *args: str) -> int: |
| 74 | """Run a shell command safely via subprocess (no shell=True). |
| 75 | |
| 76 | Args: |
| 77 | *args: Command and its arguments as separate strings, e.g. |
| 78 | ``self.run_cmd('docker', 'build', '-t', tag, '.')``. |
| 79 | |
| 80 | Returns: |
| 81 | The process return code (0 on success). |
| 82 | """ |
| 83 | result = subprocess.run(list(args), check=False) |
| 84 | return result.returncode |
| 85 | |
| 86 | def build(self) -> int: |
| 87 | pass |