def _execute_command(self, cmd, cwd=None):
        """Execute a shell command and return the result."""
        try:
            result = subprocess.run(
                cmd, shell=True, cwd=cwd, capture_output=True, text=True, check=False
            )
            return CommandResult(result.stdout, result.returncode)
        except Exception as e:
            return CommandResult(str(e), 1)
Execute a shell command and return the result.
tests/unit/test_git_handler_real.py