Run a shell command and return whether it succeeded. Args: cmd: The command to run. file_path: The file being processed (for error reporting). Returns: True if the command succeeded, False otherwise.
(cmd: List[str], file_path: str)
| 163 | |
| 164 | |
| 165 | def run_command(cmd: List[str], file_path: str) -> bool: |
| 166 | """Run a shell command and return whether it succeeded. |
| 167 | |
| 168 | Args: |
| 169 | cmd: The command to run. |
| 170 | file_path: The file being processed (for error reporting). |
| 171 | |
| 172 | Returns: |
| 173 | True if the command succeeded, False otherwise. |
| 174 | """ |
| 175 | try: |
| 176 | subprocess.run(cmd, check=True, capture_output=True, text=True) |
| 177 | return True |
| 178 | except subprocess.CalledProcessError as e: |
| 179 | print(f"Error processing {file_path}: {e}", file=sys.stderr) |
| 180 | print(f"stdout: {e.stdout}", file=sys.stderr) |
| 181 | print(f"stderr: {e.stderr}", file=sys.stderr) |
| 182 | return False |
| 183 | |
| 184 | |
| 185 | def fix_from_pycodestyle( |