field_ios

In-the-field app for Radroots on iOS
git clone https://radroots.dev/git/field_ios.git
Log | Files | Refs | README | LICENSE

xcode_child.py (835B)


      1 """Reset Bash background signal inheritance, then exec the exact owned child."""
      2 
      3 from __future__ import annotations
      4 
      5 import os
      6 import signal
      7 import sys
      8 
      9 
     10 def main(arguments: list[str]) -> int:
     11     if not arguments:
     12         return 64
     13     signal.signal(signal.SIGINT, signal.SIG_DFL)
     14     signal.signal(signal.SIGTERM, signal.SIG_DFL)
     15     # The cleanup owner defers pending signals until both dispositions are reset.
     16     os.kill(os.getppid(), signal.SIGUSR1)
     17     try:
     18         os.execvp(arguments[0], arguments)
     19     except FileNotFoundError:
     20         print("error: owned Xcode child command is unavailable", file=sys.stderr)
     21         return 127
     22     except OSError:
     23         print("error: owned Xcode child command cannot be executed", file=sys.stderr)
     24         return 126
     25 
     26 
     27 if __name__ == "__main__":
     28     raise SystemExit(main(sys.argv[1:]))