http://www.perlmonks.org?node_id=951615


in reply to Re^2: Killing process group run with IPC::Open3
in thread Killing process group run with IPC::Open3

So I ran a few tests. It seems that the child can't read from the parent's STDIN. I presume this is the problem to which you are referring.

man 2 setpgrp explains

At any time, one (and only one) of the process groups in the session can be the foreground process group for the terminal; the remaining process groups are in the background.

I don't know what a session is, but adding setsid() appears to solve the problem.

Replies are listed 'Best First'.
Re^4: Killing process group run with IPC::Open3
by pm_sanchay (Initiate) on Feb 03, 2012 at 07:49 UTC

    My bad for using pre. I will be more careful from now.

    Yes, I meant "child can't read from the parent's STDIN".

    setsid()

    does appear to work. But it has another issue - I don't understand what happens if a KILL signal is sent to parent (example cntl-c)? Will have to understand what setsid does.

    Thanks for your help.