Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Windows, threads and IPC::Open3by bloonix (Monk) |
on Nov 07, 2010 at 19:18 UTC ( [id://869942]=perlquestion: print w/replies, xml ) | Need Help?? |
bloonix has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I'm seeking for you wisdom and hope that someone can help me a bit. I wrote a little daemon that executes programs with IPC::Open3 and intercepts the output from stdout and stderr. IO::Select is used to check if a handle is ready and alarm() for timeouts within eval{}. The daemon is running very nice on linux, but unfortunately not on windows. Now I was searching for another solution and thought about to use threads. In the following example a thread is created to execute a program. The parent waits until $timeout and then detach the thread and kills the process that is maybe still running. Now my question to you is: could it be simplier? I don't know if my code example is too much dirty, because I haven't the finest idea of windows. I would be very pleased for your wisdom. Cheers Jonny Edit: a short code fix
Back to
Seekers of Perl Wisdom
|
|