On Wed, Apr 10, 2013 at 12:02 PM, Jenda Krynicky <je...@krynicky.cz> wrote:

> 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/
>
>
>
Hi Jenda

Thanks for the clarification on exec() and 'system'
Processes in Unix have so far seemed easier to handle - if you want them
destroyed, a 'kill -9' signal really does the job!
In Windows, the steps have not appeared as straight forwards as there are a
few different ways to end a process - taskkill, process -k etc etc

Hopefully, the taskkill will do the job!

Thanks for your input

Jon

Reply via email to