2

I have a Perl script that run automatic tests on Windows. It gets a directory as parameter and run each one of the exe files in it 3 times ( each time with different arguments ) The only problem I have is that sometimes the exe file may hangs for a long time or even crash. I’m not sure how to handle this with Perl, do I must use fork for this ?

I tried using several examples like this: Perl fork and kill - kill(0, $pid) always returns 1, and can't kill the child but could not understand where should I embed the exe I need to run in the examples also assuming I need to run the exe under the child, if the child process is killed does it also kill the exe ?

If you know any Perl fork for Dummies tutorial...

Community
  • 1
  • 1
Epligam
  • 741
  • 2
  • 14
  • 36
  • The solution to this post could help you: http://stackoverflow.com/questions/3967470/how-can-i-specify-timeout-limit-for-perl-system-call – Johannes Liebermann May 04 '14 at 15:45
  • You talk about "exe"? Are you on Windows? If so then most of the linux advice does not apply, since forks are actually threads in the same process on windows. – Mithaldu May 04 '14 at 16:30
  • 1
    Use IPC::Run and its timeout facility. – ikegami May 04 '14 at 16:43
  • I suspect that the hanging/ crashing applications are actually broken, right? And this is what you try to detect. You can think of very sophisticated ways how to monitor your processes, but the general rule should be to fix your programs... – Stefan Schroeder May 06 '14 at 03:50

0 Answers0