#!/usr/bin/python3 -S try: import site import os import re import subprocess import sys # Calling shellscript, that calls us if __name__ == "__main__": child = False if re.match("__", os.path.basename(sys.argv[0])): print("Indirect child being called") child = True else: subprocess.check_call(["/bin/sh", "-e", "./shellpart.sh"]) sys.exit(0) except KeyboardInterrupt: if re.match("__", os.path.basename(sys.argv[0])): print("caught signint in child") else: print("caught signint in parent")