« Return to Thread: help with EXEC usage

Re: help with EXEC usage

by Benoît Minisini :: Rate this Message:

| View in Thread

> This seems to work... but it is not very nice code, as it doesn't make
> distinction of what instance of "get_iplayer" or "mplayer
> you are dealing  with...
> Also it leaves some trash (get_iplayer doesn't take care of it's trashes!)
> to ~/.get_iplayer.
> Maybe get_iplayer should be killed with some other signal.
>
> PUBLIC SUB btnStop_Click()
> DIM pid1 AS String
> DIM pid2 AS String
>
>     IF hProc.State = Process.Running THEN
>       SHELL ("pidof get_iplayer") TO pid1
>       SHELL ("pidof mplayer") TO pid2
>       DEBUG pid1;; pid2
>       SHELL "kill " & pid1 & " " & pid2
>       hProc.Kill()
>     ENDIF
>
> END
>
> Jussi
>

Hi,

I have made the following change for Gambas 3:

When running a process with SHELL, a process group is created for that shell,
and when the Kill() method is called, the entire process group is killed
instead of just the shell process.

I tried with Bill's shell command, and it works. All the bunch run by
"get_iplayer ... | mplayer ..." is killed as expected.

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

 « Return to Thread: help with EXEC usage