[Gambas-user] help with EXEC usage

Benoît Minisini gambas at ...1...
Sat Mar 26 10:13:46 CET 2011


> 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




More information about the User mailing list