I expected the module to have my python program spawn a new process. In which case, the parent ID of the process I spawn should be the parent ID of my program. I wrote a test script for this.
C program:
#include <unistd.h>
int main(int argc, char* argv[]) {
printf("PID of C program: %ld, parent PID: %ld\n", (long)getpid(), (long)getppid());
return 0;
}
Python program:
#!/usr/bin/python3
from subprocess import run
import os
print(os.getppid())
run([os.path.join(os.getcwd(), "out")])
The parent process ID of the C program when ran this way is not the process ID of the python program. What's going on?