From: Jonathan Harris <jtnhar...@googlemail.com>
> As it seems that Win32::Process::KillProcess is having difficulties killing
> a hanging process, I thought that it would probably make sense to ask the
> system to do it directly
> 
> So, in the sub 'kill_it', I have replaced the line
> 
> Win32::Process::KillProcess ($new_pid, \$exitcode);
> 
> with
> 
> system 'Taskkill /PID ' . ($new_pid);
> 
> I am using 'system' rather than 'exec' as it returns a success status;
> 'exec' is silent in this respect

The fairly confusingly named fuction exec() never returns!
It's supposed to be used if you are done executing your program and 
want to switch to executing a different one ... usually after you 
fork()ed ... that is cloned the process.

The way processed are started in unix is a little ... awkward. 
Instead of telling the system you want to execute some program with 
some parameters, you are supposed to split in two and in one of the 
clones, after you are finished setting things up, morph into another 
program. Kinda hacky.

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to