Files
intaleq_driver/scratch/build_and_catch_error.py

46 lines
1.4 KiB
Python

import subprocess
import sys
def main():
print("Starting unsandboxed iOS build diagnostics...")
cmd = ["/Users/hamzaaleghwairyeen/flutter/bin/flutter", "build", "ios", "--no-codesign"]
# Run the command and print lines containing error or failure indicators
process = subprocess.Popen(
cmd,
cwd="/Users/hamzaaleghwairyeen/development/App/intaleq_driver",
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True
)
recent_lines = []
print_errors = False
while True:
line = process.stdout.readline()
if not line:
break
# Keep a rolling buffer of the last 30 lines
recent_lines.append(line.strip())
if len(recent_lines) > 30:
recent_lines.pop(0)
# If we see common error indicators, print them immediately
line_lower = line.lower()
if "error:" in line_lower or "failed" in line_lower or "error •" in line_lower:
print(f"🚨 FOUND ERROR: {line.strip()}")
print_errors = True
process.wait()
print(f"\nBuild finished with exit code: {process.returncode}")
if process.returncode != 0:
print("\n--- Last 30 lines of build output ---")
for rl in recent_lines:
print(rl)
if __name__ == "__main__":
main()