You can probably* set ALARM, open P,"prog |"; read from P and close. There's lots of documentation and examples in perlipc and perlopentut.
* there seem to be some issues with the safe signal handlers in recent perls. try it out.
Joost.
Update: The executed command will probably not end until it tries to write to its STDOUT, which is bound to the P file-handle in the pseudo-code above. You could try using kill to kill it immediately.
In reply to Re: Timeout on system command
by Joost
in thread Timeout on system command
by MorgothSauron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |