in reply to Re: command execution & timeout in windows
in thread command execution & timeout in windows

Hi BrowserUk,

Thank you for your reply. I've changed the Win32::Process::KillProcess statements with kill(9, $pid) but still getting the same error.

C:\venkat\Target\Work 2002\Perl>perl timeout.pl timed out... ^C C:\venkat\Target\Work 2002\Perl>

Replies are listed 'Best First'.
Re: Re: Re: command execution & timeout in windows
by BrowserUk (Patriarch) on Dec 06, 2002 at 00:04 UTC

    The problem appears to stem from the presence of the child process (a real process this time). When the kill(9,$pid) executes, the pseudo-process that executes the open(CMD, ..) is killed. However the process created by the open to run the cmd is not killed, and despite the child thread having 'gone away' (according to the task manager), the child process it spawned persists, and the timeout branch of the parent code is taken. I can only assume that the child thread is marked for deletion and no longer scheduled, but that it is still there in memory waiting for the process to terminate.

    Worse than this, even killing the child process manually , still leaves perl running the original script. and it requires ^c to terminate it.

    These are my findings so far.... if anyone reading has better knowledge, or can offer the OP a solution, please jump in and set us both straight.


    Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
    Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
    Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
    Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.