Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- open3 "sh -c" problem with pipes or redirect
September 24, 2009, 4:30 pm
rate this thread
I have a perl programming that has been running for the last 10 or so
years. It manages other processes, capturing all outputs into a
common logfile and killing dormant processes (no output) after a given
amount of time. The user can print processes up or down as needed.
It utilizes the Event.pm module and it works fine. Now I I have the
need to either run a process that utilizes a pipe "x | y" or setup two
separate processes and redirect stdin/stdout to use a named pipe ("x
a "sh -c" to execute the command. The pid that is returned is the pid
of the shell command and when I attempt to terminate the process only
the shell command is killed, not the children.
I suspect the answer is to modify the stdin/stdout file handles as
needed and pass those to open3. Is this the correct solution or is
there another way?
Currently, this is running on Solaris 8 & 10, sparc and Intel. There
is no need for portability to windows.
Re: open3 "sh -c" problem with pipes or redirect
thank you for the input. Unfortunately I did try that and it
failed. I also tried to setup a process group using setpgrp() but I
did not get that to work correctly either. I may have being doing
something wrong so that is also a possibility.
- » FAQ 5.34 How do I close a file descriptor by number?
- — Previous thread in » PERL Discussions