I am attempting to create a child process that kills the parent process, and then it ends itself. Currently, I am stuck on spawning the subprocess. Is there something I should/not be doing?
File: /main.py
def start_updater() -> None:
subprocess.run("<path>/update/main.py", input=f"{os.getpid()}")
def main() -> None:
start_updater()
File: /update/main.py
import sys
with open("<path>/update/input.txt", 'w') as file:
for line in sys.stdin:
file.write(f"{line}")
break # Only will receive one line: the PID