open3 and signals

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am using open3 to run an external program from my perl script.
Whenever the script recieves a Ctrl-C, it appaers the open pipes are
immediately shutdown. I have installed a signal handler for INT, which
sets a variable. I then immediately leave a while loop and try to send
(CLOSE\nEXIT\n") to the write handle for the open process. But it is
already closed.

Looking for any ideas to try and write the message before the process
is shudown.


Re: open3 and signals

I came up with a solution using IO::Pipe and fork.
I then talk to the child with the pipe, he runs the program, and talks
back with the pipe.
The child is in a loop checking the pipe for more request, checking
the open3 program for r and e output. It also checks the status of the
parent process, which i store right after the fork before the loop. if
kill 0 $ppid returns 0, i try and shutdown the open3 program.
If anyone would like to see the code or know more, let me know.

I think open3 might fork also, but i cant seem to disassociate the
child process and only have access thru the the r,w,e handles.


Site Timeline