| [reply] |
IPC::Cmd seems to use either IPC::Open3 or IPC::Run
The IPC::Run docs say -
start() pauses the parent until the child executes the
command or CODE reference and propagates any exceptions
thrown (including exec() failure) back to the parent. This
has several pleasant effects: any exceptions thrown in the
child, including exec() failure, come flying out of start()
or run() as though they had ocurred in the parent.
This sounds like what I'm looking for. I'll try it tomorrow and see if lives up to its promises. I would still prefer to do this with a core module if possible and avoid any hassle getting modules installed.
Edit by tye: Remove PRE tags around long lines
| [reply] |
I think that refers to the fact you can get STDERR using open3 but I'll give a looking at it.
| [reply] |
AFAIK IPC::Open2 does a fork/exec and only returns the result of the fork, so it's not really possible to find out if it didn't happen properly.
You could do something like
do { open2(bla, bla, bla) } if (-e $PROGRAM and -x $PROGRAM)
maybe. That would only eliminate a couple of things and leave plenty of room for $PROGRAM to croak for other reasons, tho. You could also handle the fork yourself, but that might get hairy. | [reply] [d/l] |
That is probably what I'll do. Loads of stuff can go wrong but -f and -x covers what is most likely to go wrong. I may throw in a ps | grep $program name to crudely cover anything else.
| [reply] |