If your requirement is Windows only, using the Win32::Job module (a thin wrapper around Win32 Job objects) may make your code simpler and easier to understand.
In Win32::Job spawn() method you can control stdin/stdout/stderr, while its run() method provides a simple way to run programs with a time limit. Another useful feature is that killing a job kills that process and all sub-processes spawned by it (similar to Unix process groups).
Sample code can be found at Re: Timing Windows commands.
In reply to Re: Run and kill external programm after x seconds
by eyepopslikeamosquito
in thread Run and kill external programm after x seconds
by demichi
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |