I wrote a program. It starts a process (call it A) that spawns a child process (call it D) that shutdowns and restarts A. Problem is, now I can't kill A nicely from the terminal (ie. CTRL-C isn't getting to it). The pgid's of A and D are the same, but it looks like the terminal drops that process group as its foreground, which is why I can't send it signals now. I suspect this happens when the parent process originally dies. Is there some way to prevent that? Can I change the foreground pgid so it looks like the child (D) is actually the parent and the terminal doesn't drop the process group?
A simple enough solution:
Have process A exec a second process A first (call it A'). Then let A block forever. A' can start D, and D can restart A', and A sticks around the whole time as the parent.