|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re: Windows run an exe print its output and cut it off after a timeby VinsWorldcom (Priest) |
| on Oct 12, 2012 at 14:43 UTC ( #998706=note: print w/ replies, xml ) | Need Help?? |
|
I too have had issues with alarm() on Windows. This is a quick workaround - not very efficient or accurate, but close to the timeout you want. $timeout is number of seconds to run before timing out. NOTE: I need an "infinite output" .exe so the './test.exe' program just prints numbers 1 .. 100000 to the screen. I set my $timeout for 2 seconds.
And the output:
Of course you could maybe use Time::HiRes to get more accurate.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||