open3 and signals

M

Mike

Hi,
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.

Thanks
Mike
 
M

Mike

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.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top