[Gambas-user] Propper way to kill a runnin process

Stefano Palmeri rospolosco at ...152...
Mon Mar 10 17:25:28 CET 2008


Alle 14:54, lunedì 10 marzo 2008, M0E Lnx ha scritto:
> Sorry, hit the send button by accident... here it is
>
> I have on my vpackager application one shell process that run on
> several stages. I have a function that constantly checks the output of
> this process for "keywords" that if found, need to immediately kill
> the process. Here is how I'm killing the process
>
> PUBLIC SUB ABORT_PROCESS()
> IF instr(sBuffer, "FAILED") > 0 THEN
>   IF hMyProc.State = Process.Running THEN
>    hMyProc.kill
>   END IF
> END IF
> END
>

Uhm... that shoud work. 
Anyway, try this to kill the 'rebel' process:

SHELL "kill -9 " & hMyProc.Id WAIT


and see what happens.

Stefano

> The problem is that altough on the screen it appears the sub run
> without error, I can still feel the CPU is running... I can hear it
> too. My system monitor shows high CPU useage even after the code has
> ran.
> Is there another way to do this more accurately?
>
> Using gambas2-2.0.0
> Thanks
>
> On 3/10/08, M0E Lnx <m0e.lnx at ...626...> wrote:
> > I have on my vpackager application one shell process that run on
> >  several stages. I have a function that constantly checks the output of
> >  this process for "keywords" that if found, need to immediately kill
> >  the process. Here is how I'm killing the process
> >
> >  PUBLIC SUB ABORT_PROCESS()
> >  IF instr(sBuffer, "FAILED") > 0 THEN
> >    IF hMyProc.State = Process.Running THEN
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list