Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: system() with timeout

by Sprad (Hermit)
on Mar 18, 2004 at 11:18 UTC ( [id://337722]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: system() with timeout
in thread system() with timeout

Dang. I'm stuck with 5.6.1, so it looks like the alarm method isn't going to work for me...

---
A fair fight is a sign of poor planning.

Replies are listed 'Best First'.
Re: Re: Re: system() with timeout
by tachyon (Chancellor) on Mar 18, 2004 at 11:59 UTC

    Why not. 5.6.1 supports alarm, just not on Win32.

    cheers

    tachyon

      According to the thread linked above, signals are unsafe in version below 5.8. (and I am using Win32, so even then...)

      ---
      A fair fight is a sign of poor planning.

      Under Win32, create a separate thread and start your external process under that thread. Back in the parent thread, start counting until you want the timout to expire (or Wait() for it) then kill the thread. It looks something like this:
      Win32::Process::Create($proc, "c:\foo.exe", "foo.exe arg1 arg2 arg3", 0, $priority, ".") || die "can't create process, ". Win32::FormatMessage( Win32 +::GetLastError()); my $ret= $proc->Wait($timeoutsecs * 1000); if (! $ret ) { # Still running, kill it. $proc->Kill(0); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://337722]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.